Skip to content

Loading…

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

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

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

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

@doctrinebot

Comment created by @beberlei:

Fixed and merged into 2.3.x branch

@doctrinebot

Issue was closed with resolution "Fixed"

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.3.3 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.