count on Extra Lazy many-to-many requiring ID where LAZY does not #6197

Open
opened 2026-01-22 15:28:43 +01:00 by admin · 1 comment
Owner

Originally created by @parljohn on GitHub (Mar 7, 2019).

Bug Report

Id of joined column doesn't work without the join column of the owner being an ID field.

    $id             = $this->uow->getEntityIdentifier($collection->getOwner());

Line 119 of ManytoManyPersister.
which only runs when EXTRA LAZY. Otherwise, count and LAZY functions work fine.

Expected behavior

Allow for non ID fields to be used in many-to-many relationships and allow for EXTRA_LAZY functionality.

Originally created by @parljohn on GitHub (Mar 7, 2019). ### Bug Report Id of joined column doesn't work without the join column of the owner being an ID field. $id = $this->uow->getEntityIdentifier($collection->getOwner()); Line 119 of ManytoManyPersister. which only runs when EXTRA LAZY. Otherwise, count and LAZY functions work fine. #### Expected behavior Allow for non ID fields to be used in many-to-many relationships and allow for EXTRA_LAZY functionality.
admin added the BugInvalid labels 2026-01-22 15:28:43 +01:00
Author
Owner

@Ocramius commented on GitHub (Mar 8, 2019):

Allow for non ID fields to be used in many-to-many relationships

All joinColumns MUST be identifiers, since the ORM builds associations internally (in memory) only with identifiers.

Please validate your mappings (orm:validate-schema) and if it doesn't fail, then we should probably add further assertions to the metadata drivers.

@Ocramius commented on GitHub (Mar 8, 2019): > Allow for non ID fields to be used in many-to-many relationships All `joinColumn`s *MUST* be identifiers, since the ORM builds associations internally (in memory) **only** with identifiers. Please validate your mappings (`orm:validate-schema`) and if it doesn't fail, then we should probably add further assertions to the metadata drivers.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6197