/** * Retrieves collection with id $id or throws an exception if it doesn't exist * * @param integer $id A Collection identifier * * @return Collection * * @throws NotFoundHttpException */ protected function getCollection($id) { $collection = $this->collectionManager->find($id); if (null === $collection) { throw new NotFoundHttpException(sprintf('Collection (%d) not found', $id)); } return $collection; }
/** * @param CollectionInterface|int $id * @param CollectionInterface|null $default * * @return CollectionInterface */ protected final function getCollection($id, CollectionInterface $default = null) { if ($id instanceof CollectionInterface) { return $id; } if (is_numeric($id)) { return $this->collectionManager->find($id); } return $default; }