From a37421bf57050573948e35728e36fd25392ab41f Mon Sep 17 00:00:00 2001 From: Pierre Rolland Date: Mon, 5 Feb 2018 22:48:43 +0100 Subject: [PATCH] Fixed query --- Builder/EntityBuilder.php | 2 +- ParamConverter/EntityParamConverter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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(); }