Skip to content

Commit 6bc88a8

Browse files
author
Martijn Hartlief
committed
Reload entity
1 parent 23af700 commit 6bc88a8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Form/DataTransformer/EntityToPropertyTransformer.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public function transform($entity)
5353
}
5454
$accessor = PropertyAccess::createPropertyAccessor();
5555

56+
$entity = $entity = $this->em->getRepository($this->className)
57+
->createQueryBuilder('e')
58+
->select('e')
59+
->where('e.' . $this->primaryKey . ' = :id')
60+
->setParameter('id', $accessor->getValue($entity, $this->primaryKey))
61+
->getQuery()
62+
->getSingleResult();
63+
5664
$text = is_null($this->textProperty)
5765
? (string)$entity
5866
: $accessor->getValue($entity, $this->textProperty);

0 commit comments

Comments
 (0)