Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can be entities stored in other location, than in entity directory?

Tags:

symfony

I am trying to store entities in MyBundle/OtherNamespacePart/Entity directory.

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

Class MyBundle/Entity/MyEntity does not exist and could not be loaded.

I don't get, why is "OtherNamespacePart" ignored (should be MyBundle/OtherNamespacePart/Entity/MyEntity). I checked whole project if there is everything namespaced and named correctly and it seems to me ok. If i store entities directly in entity directory, it works (just need to remove all "OtherNamespacePart").

Isn't problem in console command tool, that expects entities in entity directory? Is there any workaround or configuration option?

like image 619
ramoo Avatar asked Feb 20 '12 13:02

ramoo


1 Answers

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

e.g.:

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
like image 177
mazen Avatar answered Oct 30 '22 16:10

mazen