DDC-2246: ORM\UnitOfWork::getEntityState() crash when using a new Entity with association composite key #2828

Closed
opened 2026-01-22 14:05:05 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 17, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user keksnicoh:

I already found a similar issue report but it seems to be not solved completely:

http://doctrine-project.org/jira/browse/DDC-1382

I did something like this (mock): (Metadata cache is OFF)
$someCompositeEntity = new SomeCompositeEntity;
$someCompositeEntity->setUser($userEntity);
$someCompositeEntity->setAnotherRelation($anotherRelationEntity);

// Note: $userEntity & $anotherRelationEntity are managed by UOW.

$uow = $em->getUnitOfWork();
var_dump($uow->getEntityState($someCompositeEntity));

-- EXPECTED: --
bool(false)

-- ACTUAL RESULT: --

PHP Error [4096]

Object of class Application\Model\Db\Entity\User could not be converted to string (/Users/keksnicoh/lokalhorst/FinQ/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:2754)

#0 unknown(0): CWebApplication->handleError()
#1 /Users/keksnicoh/lokalhorst/FinQ/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(2754): implode()
#2 /Users/keksnicoh/lokalhorst/FinQ/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1389): Doctrine\ORM\UnitOfWork->tryGetById()
#3 /Users/keksnicoh/lokalhorst/FinQ/Application/Model/Db/Model/AnswerCommentRating.php(42): Doctrine\ORM\UnitOfWork->getEntityState()

As you see the metadatainfo tries to convert the composite objects to strings, instead of getting the identifiers from the objects.

greetz
keksnicoh
Originally created by @doctrinebot on GitHub (Jan 17, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user keksnicoh: I already found a similar issue report but it seems to be not solved completely: http://doctrine-project.org/jira/browse/[DDC-1382](http://www.doctrine-project.org/jira/browse/DDC-1382) I did something like this (mock): (Metadata cache is OFF) $someCompositeEntity = new SomeCompositeEntity; $someCompositeEntity->setUser($userEntity); $someCompositeEntity->setAnotherRelation($anotherRelationEntity); // Note: $userEntity & $anotherRelationEntity are managed by UOW. $uow = $em->getUnitOfWork(); var_dump($uow->getEntityState($someCompositeEntity)); -- EXPECTED: -- bool(false) -- ACTUAL RESULT: -- <h1>PHP Error [4096]</h1> <p>Object of class Application\Model\Db\Entity\User could not be converted to string (/Users/keksnicoh/lokalhorst/FinQ/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php:2754)</p> <pre>#0 unknown(0): CWebApplication->handleError() #1 /Users/keksnicoh/lokalhorst/FinQ/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(2754): implode() #2 /Users/keksnicoh/lokalhorst/FinQ/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1389): Doctrine\ORM\UnitOfWork->tryGetById() #3 /Users/keksnicoh/lokalhorst/FinQ/Application/Model/Db/Model/AnswerCommentRating.php(42): Doctrine\ORM\UnitOfWork->getEntityState() As you see the metadatainfo tries to convert the composite objects to strings, instead of getting the identifiers from the objects. greetz keksnicoh
admin added the Bug label 2026-01-22 14:05:05 +01:00
admin closed this issue 2026-01-22 14:05:06 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 20, 2013):

Comment created by @beberlei:

Fixed and merged into 2.3.x branch

@doctrinebot commented on GitHub (Jan 20, 2013): Comment created by @beberlei: Fixed and merged into 2.3.x branch
Author
Owner

@doctrinebot commented on GitHub (Jan 20, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Jan 20, 2013): 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#2828