Closed VincentLanglet closed 3 months ago
You already can use custom extension https://github.com/doctrine/orm/blob/55c4845d5734bea5579424c2c2a7c5b97dbb4c60/src/Mapping/Driver/XmlDriver.php#L44-L52
Following should work, in theory:
$v2 = new XmlDriver($locator, '.orm2.xml');
$v3 = new XmlDriver($locator, '.orm3.xml');
Yes, but I didn't find any occurence of XmlDriver in the library https://github.com/search?q=repo%3Asonata-project%2FSonataUserBundle%20XmlDriver&type=code
But after more thought, I think it's because it's automatically loaded by DoctrineOrmBundle. So the issue should maybe be open in https://github.com/doctrine/DoctrineBundle instead ?
Feature Request
Summary
I might be wrong but compatibility with both doctrine ORM 2 and ORM 3 is not easy for lib like SonataUserBundle which use xml configuration like https://github.com/sonata-project/SonataUserBundle/blob/5.x/src/Resources/config/doctrine/BaseUser.orm.xml
In this one the type array was removed in ORM 3, but changing the xml would be a BC break for ORM 2 user since it require a migration for the database.
What could be helpful would be the way to use a
.orm3.xml
file with the following logic:Foo.orm3.xml
overFoo.orm.xml
Foo.orm.xml
and ignoreFoo.orm3.xml
Same logic could be done for other major versions, if doctrine finds a
Foo.orm{majorVersion}.xml
and aFoo.orm.xml
file it prefers theFoo.orm{majorVersion}.xml
with the right majorVersion.