-
-
Notifications
You must be signed in to change notification settings - Fork 77
5.3.x: duplicate Doctrine column mapping when both CredentialRecord and PublicKeyCredentialSource XML mappings are loaded #824
Description
Version(s) affected
5.3.x-dev
Description
Hi,
since I want to upgrade my application to Symfony 8 I was playing with webauthn 5.3.x-dev a bit as 5.2 is blocking the update to Symfony 8.
I know this is not a real bug as my report is related to a dev branch. It's just to make sure you are aware of it :)
On 5.3.x, Webauthn\PublicKeyCredentialSource is deprecated and now extends Webauthn\CredentialRecord.
However, the Symfony bundle still registers both Doctrine XML mapping files:
CredentialRecord.orm.xmlPublicKeyCredentialSource.orm.xml
With Doctrine ORM 3, this leads to duplicate field definitions inherited through the class hierarchy.
And Doctrine fails with:
Duplicate definition of column 'public_key_credential_id' on entity 'Webauthn\PublicKeyCredentialSource' in a field or discriminator column mapping.
How to reproduce
Environment:
symfony/framework-bundle:8.0.*doctrine/orm:^3.6web-auth/webauthn-lib:5.3.x-devweb-auth/webauthn-symfony-bundle:5.3.x-dev
Custom entity:
use Webauthn\CredentialRecord;
class WebauthnCredential extends CredentialRecord
{
}Then run:
php bin/console make:migration
Actual result
Doctrine fails with:
Duplicate definition of column 'public_key_credential_id' on entity 'Webauthn\PublicKeyCredentialSource' in a field or discriminator column mapping.
Expected result
Only one effective mapped superclass definition should be loaded for the credential record fields in 5.3.x.
Possible Solution
PublicKeyCredentialSource.orm.xml should probably no longer be registered, or should otherwise be excluded when PublicKeyCredentialSource is just a deprecated subclass of CredentialRecord.
Additional Context
The issue seems to come from the bundle still registering all XML files from:
src/symfony/src/Resources/config/doctrine-mapping
including PublicKeyCredentialSource.orm.xml.
As a local workaround, removing PublicKeyCredentialSource.orm.xml makes the mapping conflict disappear.