I use doctrine in my symfony 2.3 application. I want to use a folder structure like
/MyBundleName/User/User.php
for my Entities.
Question:
Is there anyway that I can explicitly map doctrine ORM directly to use an explicit directory instead of defaulting to the Entity
Directory of my Bundle?
I would like to keep all related files in their respective directory such as ProductProvider
in
/MyBundleName/Product/ProductProvider.php
Any help would be greatly appreciated.
you can tell Doctrine the directory where is your entities
Here you have the full documentation Doctrine configuration
I made a similar question a few days ago, there you can read the full answer Cedar gave me
Similar post
Just to follow up a bit on @Imanol's correct answer, it is possible to have your entities in multiple directories under one entity manager:
Don't worry about the is_bundle: false entries. The entities can still live in a bundle. Doctrine does not care. And in case you are wondering, the alias parameter lets you do things like:
I've spent some time trying to figure out the simplest case. This is how I made it work:
I simply wanted to store my entities in a directory called 'Model' inside my bundle, instead of the default 'Entity'.