collectionRepository = $collectionRepository; } /** * @return \collection[] */ public function findAll() { if ($this->collectionCache === null) { $this->collectionCache = $this->collectionRepository->findAll(); } return $this->collectionCache; } /** * @param int $collectionId * @return \collection|null */ public function find($collectionId) { $collections = $this->findAll(); if (isset($collections[$collectionId])) { return $collections[$collectionId]; } return null; } }