DDC-1540: Associations-keys not detected properly when using the XMLDriver #1935

Closed
opened 2026-01-22 13:32:27 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 14, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user saem:

When using the association-key attribute on an id element in an XML mapping, a MappingException is thrown:

[Doctrine\ORM\Mapping\MappingException]
No identifier/primary key specified for Entity 'Foo\BarBundle\Entity\Baz'. Every Entity must have an identifier/primary key.

This is because in the XMLDriver.php file (version 2.1.2)

Line 213 reads: $associationIds[(string)$idElement['fieldName']] = true;

When it should read: $associationIds[(string)$idElement['name']] = true;

This was fixed on master here, but has not be back ported -- as I understand it master is 2.x. This is a fairly significant issues for users of the XMLDriver, currently a show stopper on our work, especially as we're using Symfony Standard distribution 2.0.6 -- 2.0.7 references a version of Doctrine with another bug.

I've confirmed that this bug exists in 2.1.2, and 2.1.4, but it probably effects more versions.

Originally created by @doctrinebot on GitHub (Dec 14, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user saem: When using the association-key attribute on an id element in an XML mapping, a MappingException is thrown: [Doctrine\ORM\Mapping\MappingException] No identifier/primary key specified for Entity 'Foo\BarBundle\Entity\Baz'. Every Entity must have an identifier/primary key. This is because in the XMLDriver.php file (version 2.1.2) Line 213 reads: $associationIds[(string)$idElement['fieldName']] = true; When it should read: $associationIds[(string)$idElement['name']] = true; This was fixed on master [here](https://github.com/doctrine/doctrine2/commit/2ce924673392fb6cb18370e84a116a64d989c2a5), but has not be back ported -- as I understand it master is 2.x. This is a fairly significant issues for users of the XMLDriver, currently a show stopper on our work, especially as we're using Symfony Standard distribution 2.0.6 -- 2.0.7 references a version of Doctrine with another bug. I've confirmed that this bug exists in 2.1.2, and 2.1.4, but it probably effects more versions.
admin added the Bug label 2026-01-22 13:32:27 +01:00
admin closed this issue 2026-01-22 13:32:27 +01:00
Author
Owner

@doctrinebot commented on GitHub (Dec 15, 2011):

Comment created by @beberlei:

Merged

@doctrinebot commented on GitHub (Dec 15, 2011): Comment created by @beberlei: Merged
Author
Owner

@doctrinebot commented on GitHub (Dec 15, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Dec 15, 2011): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1935