mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1623: Doctrine2 bug searching entities in a non default path #2042
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Jan 28, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user sibok:
Hi,
i've placed entities inside myVendor\myBundleBundle\Entity namespace which are properly handled by mysql entity manager, and also placed entitites inside myVendor\myBundleBundle\View which are readonly entities which should be handled by form entity manager.
i've configured my bundle entity manager in the following way:
doctrine:
dbal:
default_connection: mysql
connections:
mysql:
user: %mysql_database_user%
password: %mysql_database_password%
host: %mysql_database_host%
dbname: %mysql_database_name%
charset: UTF8
driver: %mysql_database_driver%
logging: %kernel.debug%
form:
port: %form_database_port%
user: %form_database_user%
password: %form_database_password%
host: %form_database_host%
dbname: %form_database_name%
charset: UTF8
driver: %form_database_driver%
logging: %kernel.debug%
orm:
auto_generate_proxy_classes: %kernel.debug%
#auto_mapping: true
default_entity_manager: default
entity_managers:
default:
connection: mysql
mappings:
myVendormyBundleBundle: ~
form:
connection: formacions
mappings:
myVendormyBundleBundle: { type: annotation, dir: View/Entity }
and doctrine is looking for entities in the specified directory but it is only able to find them when the namespace contains Entity word. So when namespace is myVendor\myBundleBundle\View; the command ./symfony2 doctrine:mapping:info --em=for complains saying:
[LogicException]
You do not have any mapped Doctrine ORM entities for any of your bundles. Create a class inside the Entity namespace of any of your bundles and provide mapping information for it with Annotations directly in the classes doc blocks or with XML/YAML in your bundles Resources/config/doctrine/ directory
When i change the namespace to myVendor\myBundleBundle\Entity; Although entities are placed inside View\ it seems to work fine:
./symfony2 doctrine:mapping:info --em=for
Found 1 entities mapped in entity manager for:
[OK] myVendor\myBundleBundle\Entity\myEntity
@doctrinebot commented on GitHub (Jan 28, 2012):
Comment created by @beberlei:
This is not a Doctrine issue.
To change the default namespace you have to use "is_bundle: false" and in "dir" you have to walk relative to "%kernel.root_dir%"
@doctrinebot commented on GitHub (Jan 28, 2012):
Issue was closed with resolution "Invalid"
@doctrinebot commented on GitHub (Jan 28, 2012):
Comment created by sibok:
SOLVED!! Thanks a lot for pointing me in the right way!!! :_)
Thanks a lot!
The same happens after updating config.yml following your tips.
It doesn't matter if i use View or Entity, same issues happens.
myVendormyBundleBundle: { type: annotation, is_bundle: false, prefix: "myVendor\myBundle\Entity", dir: "%kernel.root_dir%/../src/myVendor/myBundle/Entity" }
myVendormyBundleBundle: { type: annotation, is_bundle: false, prefix: "myVendor\myBundle\View", dir: "%kernel.root_dir%/../src/myVendor/myBundle/View" }
sibok@PauPC ~/public_html/myProject $ php app/console doctrine:mapping:info --em=formacions
[LogicException]
You do not have any mapped Doctrine ORM entities for any of your bundles. Create a class inside the Entity namespace of any of your bundles and provide mapping information for it with Annotations directly in the classes doc blocks or with XML/YAML in your bundles Resources/config/doctrine/ directory.
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 2 attachments from Jira into https://gist.github.com/471c003279f19b6f8b17