Doctrine 2 - Entities in more than one directory

2

Good morning, I'm starting in Doctrine 2.4 and I'm developing a system where I separate core files from application files, as follows:

/root
   |-- /src
        |-- /App
              |-- /Model
                    |-- **(Entidades da Aplicação)**
        |-- /Core
              |-- /Model
                    |-- **(Entidades do Core)**

The Doctrine documentation shows the following way to set up 1 directory for Entitys:

$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/src"), $isDevMode);

But how do I configure when I have more than 1 directory that will contain the Entitys of my application, as my example?

    
asked by anonymous 03.06.2014 / 13:45

1 answer

1

Simple:

Put like this:

$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__."/src/App/Model/", __DIR__."/src/Core/Model/"), $isDevMode);

As the first paramenter of createAnnotationMetadataConfiguration is of type array , then put the directories that are part of the mapping of your application, see the example of the paramenter below:

array(__DIR__."/src/App/Model/", __DIR__."/src/Core/Model/")

References:

03.06.2014 / 20:56