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; } public function save(Collection $collection) { $this->collectionRepository->save($collection); if ($this->collectionCache !== null) { $this->collectionCache[$collection->get_coll_id()] = $collection; } } }