Could there be objects stored in a different place than in the entity directory?

I am trying to save objects in the MyBundle / OtherNamespacePart / Entity directory.

If I run doctrine:schema:create , I get this error message:

The class MyBundle / Entity / MyEntity does not exist and cannot be loaded.

I do not understand why "OtherNamespacePart" is ignored (should be MyBundle / OtherNamespacePart / Entity / MyEntity). I checked the whole project if there are all the names and the names are correct, and it seems good to me. If I store objects directly in the entity directory, it works (you just need to delete all "OtherNamespacePart").

Is there a problem in the console command tool that expects entities in the entity directory? Is there any workaround or setting?

+4
source share
1 answer

You can do this by providing custom mappings in config.yml

eg:.

 doctrine: orm: auto_generate_proxy_classes: %kernel.debug% auto_mapping: false mappings: name: type: xml dir: %kernel.root_dir%/../src/Your/Bundle/Resources/config/doctrine alias: MyModels prefix: MyBundle\OtherNamespacePart\Entity is_bundle: false 
+14
source

Source: https://habr.com/ru/post/1397427/


All Articles