mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1794: DriverChain unable to load mixed Drivers at given sort of load. #2256
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Apr 22, 2012).
Originally assigned to: @beberlei on GitHub.
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
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 'Entities_1.BugStatus.dcm.yml' for class 'Entities_1\BugStatus'.
[FAIL] Entities_1\Client
No mapping file found named 'Entities_1.Client.dcm.yml' for class 'Entities_1\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/doctrine_full/entities_1';
$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 commented on GitHub (Jul 5, 2012):
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 commented on GitHub (Jul 5, 2012):
Issue was closed with resolution "Invalid"