DDC-1794: DriverChain unable to load mixed Drivers at given sort of load. #2448

Closed
doctrinebot opened this Issue Apr 22, 2012 · 2 comments

2 participants

@doctrinebot

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.

Annotations-Xml, Xml-Annotations
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.

Annotations-Yaml, Yaml-Annotations
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:
[OK] Entities\Bug
[OK] Entities\Product
[OK] Entities\User
[FAIL] Entities_1\BugStatus
No mapping file found named 'Entities1.BugStatus.dcm.yml' for class 'Entities1\BugStatus'.

[FAIL] Entities_1\Client
No mapping file found named 'Entities1.Client.dcm.yml' for class 'Entities1\Client'.

jago@jagobook:/media/Documentos/Programacion/localhost/doctrine_full/libraries/Doctrine/bin>

Seem that search metadata from Yaml configuration, when they are added to DriverChain using Annotation driver:


//YAML
require_once '../../../entities/Bug.php';
require_once '../../../entities/Product.php';
require_once '../../../entities/User.php';
$path = '/media/Documentos/Programacion/localhost/doctrine_full/entities/mapping';
$yaml = new \Doctrine\ORM\Mapping\Driver\YamlDriver( array( $path ) );
$dc->addDriver( $yaml, "Entities" );

//Annotations
$path = '/media/Documentos/Programacion/localhost/doctrinefull/entities1';
$an2 = $config->newDefaultAnnotationDriver( $path );
$dc->addDriver( $an2, "Entities_1" );

$config->setMetadataDriverImpl( $dc );

Or I miss something?

Thanks in advance.

Some screenshots, see in transparent console code from NetBeans

annotations then xml
http://i.imgur.com/BfIKC.png

xml then annotations
http://i.imgur.com/hqsJ0.png


annotations then yaml
http://i.imgur.com/Linrs.png

yaml then annotations (error)
http://i.imgur.com/gctpI.png

@doctrinebot

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.

@doctrinebot

Issue was closed with resolution "Invalid"

@beberlei beberlei was assigned by doctrinebot Dec 6, 2015
@doctrinebot doctrinebot closed this Dec 6, 2015
@doctrinebot doctrinebot added the Bug label Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment