Skip to content

Commit

Permalink
Merge branch '2.x' into '3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhemN committed Aug 18, 2021
2 parents ef4d04c + df8527e commit 3c9a2cb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Form/Transformer/EntityToIdObjectTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

namespace FOS\RestBundle\Form\Transformer;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\Persistence\ObjectManager as LegacyObjectManager;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Form\DataTransformerInterface;
use Symfony\Component\Form\Exception\TransformationFailedException;

Expand All @@ -27,8 +28,12 @@ class EntityToIdObjectTransformer implements DataTransformerInterface
private $om;
private $entityName;

public function __construct(ObjectManager $om, string $entityName)
public function __construct($om, string $entityName)
{
if (!$om instanceof ObjectManager && !$om instanceof LegacyObjectManager) {
throw new \TypeError(sprintf('The first argument of %s() must be an instance of "%s" ("%s" given).', __METHOD__, ObjectManager::class, is_object($om) ? get_class($om) : gettype($om)));
}

$this->entityName = $entityName;
$this->om = $om;
}
Expand Down

0 comments on commit 3c9a2cb

Please sign in to comment.