Jira issue originally created by user feathersanddown:
From doctrine mailing list http://groups.google.com/group/doctrine-user/browse_thread/thread/86b9a732f3cc1626
I'm trying to load different mappings methods using DriverChain. My example code is from bug tracker tutorial. I have 3 classes under 'entities' folder: Bug, Product, User that have Annotations and Yaml mapping files, then I've added two more entities under 'entities_1' folder: BugStatus and Client with Annotations and Xml mapping files. 'status' field from Bug table point to BugStatus id, same thing to 'client' field from Client that point to Product. I know is a bad design, is only for test. So you can see, there is a dependency from first three files to last two classes.
My tests are only using console with: php doctrine orm:info
1) I can load last two files using Annotations and Xml, so they work as stand alone.
2) At run time, first I load three files from 'entities' using Annotations, then load two files from 'entities_1' using Xml and both work. (info appear [OK] in all 5 classes).
3) At run time, first I load two files from 'entities_1' using Xml, then load three files from 'entities' using Annotations and both work too.
4) At run time, first I load two files from 'entities_1' using Annotation driver, then load three files from 'entities' using Yaml driver and both work.
5) At run time, first I load three files from 'entities' using Yaml driver, then load two files from 'entities_1' using Annotation driver and fail with this error:
jago@jagobook:/media/Documentos/Programacion/localhost/doctrine_full/libraries/Doctrine/bin> php doctrine orm:info
Found 5 mapped entities:
No mapping file found named 'Entities1.BugStatus.dcm.yml' for class 'Entities1\BugStatus'.
No mapping file found named 'Entities1.Client.dcm.yml' for class 'Entities1\Client'.
Seem that search metadata from Yaml configuration, when they are added to DriverChain using Annotation driver:
$path = '/media/Documentos/Programacion/localhost/doctrine_full/entities/mapping';
$yaml = new \Doctrine\ORM\Mapping\Driver\YamlDriver( array( $path ) );
$dc->addDriver( $yaml, "Entities" );
$path = '/media/Documentos/Programacion/localhost/doctrinefull/entities1';
$an2 = $config->newDefaultAnnotationDriver( $path );
$dc->addDriver( $an2, "Entities_1" );
Or I miss something?
Thanks in advance.
annotations then xml
xml then annotations
annotations then yaml
yaml then annotations (error)
Comment created by @beberlei:
this obviouisly doesnt work, as Entities match Entities_1 already. You have to sort them in reverse order to make it working.
Issue was closed with resolution "Invalid"