function getById($id) { Validation::notEmpty($id, 'id'); $entity = $this->findById($id); if ($entity === NULL) { throw new \Exception("Cannot locate '{$this->entityClassName}' for id '{$id}'."); } return $entity; }