Skip to content

Commit 909afcd

Browse files
ISSUE-16: Added support for entity aliases
1 parent ee82c65 commit 909afcd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/EntityToIdentifierTransformer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ class EntityToIdentifierTransformer implements DataTransformerInterface
5858
public function __construct(ObjectManager $entityManager, $className)
5959
{
6060
$this->entityManager = $entityManager;
61-
$this->className = $className;
62-
$this->repository = $this->entityManager->getRepository($this->className);
63-
$this->metadata = $this->entityManager->getClassMetadata($this->className);
61+
$this->repository = $this->entityManager->getRepository($className);
62+
$this->metadata = $this->entityManager->getClassMetadata($className);
63+
$this->className = $this->metadata->getName();
6464

6565
if ($this->metadata->isIdentifierComposite) {
6666
throw new InvalidArgumentException('Expected an entity with a single identifier.');
@@ -86,9 +86,9 @@ public function transform($value)
8686
throw new TransformationFailedException('Expected an object.');
8787
}
8888

89-
$class = ClassUtils::getClass($value);
89+
$className = ClassUtils::getClass($value);
9090

91-
if ($class !== $this->className) {
91+
if ($className !== $this->className) {
9292
throw new TransformationFailedException(sprintf('Expected entity %s.', $this->className));
9393
}
9494

0 commit comments

Comments
 (0)