Commit cc60166b authored by Avris's avatar Avris

v4.0

parent 81bd4b85
......@@ -3,6 +3,7 @@ namespace Avris\Micrus\Doctrine;
use Avris\Micrus\Exception\NotFoundException;
use Avris\Micrus\Model\MatchProvider;
use Avris\Micrus\Tool\QueueBag;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\MappingException;
......@@ -32,16 +33,15 @@ class DoctrineMatchProvider implements MatchProvider
}
}
public function fetch(\ReflectionParameter $parameter, array &$tags)
public function fetch(\ReflectionParameter $parameter, QueueBag $tags)
{
if (!count($tags)) {
if ($tags->isEmpty()) {
return null;
}
$repo = $this->em->getRepository($parameter->getClass()->getName());
$value = reset($tags);
$key = key($tags);
list($key, $value) = $tags->dequeue();
$entity = $repo->findOneBy([$key => $value]);
......@@ -54,8 +54,6 @@ class DoctrineMatchProvider implements MatchProvider
));
}
unset($tags[$key]);
return $entity;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment