diff --git a/Builder/EntityBuilder.php b/Builder/EntityBuilder.php index a8a8d75..287e2e9 100644 --- a/Builder/EntityBuilder.php +++ b/Builder/EntityBuilder.php @@ -161,7 +161,7 @@ private function retrieveAssociationValue($fromClass, $targetClass, array $reque } } if (count($search) === count($identifiers)) { - $value = $repo->findBy($search); + $value = $repo->findOneBy($search); if (!$value) { $value = new $targetClass(); } diff --git a/ParamConverter/EntityParamConverter.php b/ParamConverter/EntityParamConverter.php index 3d5aed1..e03298a 100644 --- a/ParamConverter/EntityParamConverter.php +++ b/ParamConverter/EntityParamConverter.php @@ -55,7 +55,7 @@ function apply(Request $request, ParamConverter $configuration) } if (count($search) === count($identifiers)) { - $entity = $this->entityManager->getRepository($configuration->getClass())->findBy($search); + $entity = $this->entityManager->getRepository($class)->findOneBy($search); if (!$entity) { $entity = new $class(); }