DDC-1399: Wrong count() value in many-to-many relationship and EXTRA_LAZY #1754

Closed
opened 2026-01-22 13:24:39 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Sep 30, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user elnino:

Relation many-to-many, EXTRA_LAZY, $user is owning side. Without EXTRA_LAZY all is ok.

Main problem: counter is increased twice.

$user->getPhotos()->count(); // returns 100 (OK)
$user->addPhoto($photo);
$user->getPhotos()->count(); // returns 101 (OK)
$em->flush();
$user->getPhotos()->count(); // returns 102 (WRONG! Should be 101)

Originally created by @doctrinebot on GitHub (Sep 30, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user elnino: Relation many-to-many, EXTRA_LAZY, $user is owning side. Without EXTRA_LAZY all is ok. Main problem: counter is increased twice. $user->getPhotos()->count(); // returns 100 (OK) $user->addPhoto($photo); $user->getPhotos()->count(); // returns 101 (OK) $em->flush(); $user->getPhotos()->count(); // returns 102 (WRONG! Should be 101)
admin added the Bug label 2026-01-22 13:24:39 +01:00
admin closed this issue 2026-01-22 13:24:39 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 31, 2011):

Comment created by @beberlei:

verified.

@doctrinebot commented on GitHub (Oct 31, 2011): Comment created by @beberlei: verified.
Author
Owner

@doctrinebot commented on GitHub (Oct 31, 2011):

Comment created by @beberlei:

fixed

@doctrinebot commented on GitHub (Oct 31, 2011): Comment created by @beberlei: fixed
Author
Owner

@doctrinebot commented on GitHub (Oct 31, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Oct 31, 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#1754