public function get($entity, $key = 'id', $throw = TRUE)
{
$params = $this->getRequest()->getParams();
if (!isset($params[$key])) {
if ($throw) {
throw new InvalidArgumentException();
}
return NULL;
}
$match = $this->em->find($this->getClassName($entity), $params[$key]);
if (!$match) {
if ($throw) {
throw new InvalidArgumentException();
}
return NULL;
}
return $match;
}