[DDC-2246] ORM\UnitOfWork::getEntityState() crash when using a new Entity with association composite key Created: 17/Jan/13  Updated: 20/Jan/13  Resolved: 20/Jan/13

Status: Resolved
Project: Doctrine 2 - ORM
Component/s: ORM
Affects Version/s: 2.3.2
Fix Version/s: 2.3.3
Security Level: All

Type: Bug Priority: Major
Reporter: keks nicoh Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None


 Description   

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: –
<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



 Comments   
Comment by Benjamin Eberlei [ 20/Jan/13 ]

Fixed and merged into 2.3.x branch

Generated at Mon Jul 28 10:34:59 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.