protected function throw404IfNotFound($entity, $message = 'Not Found') { if (!$entity) { throw $this->createNotFoundException($this->get('translator')->trans($message)); } return true; }