/** * Renvoie les ponts des rivières de la collection * @return InfrastructureCollection */ public function getPonts() { if (is_null($this->cachePonts)) { $this->cachePonts = new InfrastructureCollection(); foreach ($this as $riviere) { /** @var Riviere $riviere */ if (InfrastructureStore::existsByHexas($riviere->getHexa1(), $riviere->getHexa2())) { $this->cachePonts->ajout(InfrastructureStore::getByHexas($riviere->getHexa1(), $riviere->getHexa2())); } } } return $this->cachePonts; }
/** * Ajoute une Infrastructure au cache sans passer par une requête * @param Infrastructure $infra */ public function addInfrastructureToCache(Infrastructure $infra) { if (is_null($this->cacheInfrastructures)) { $this->cacheInfrastructures = new InfrastructureCollection(); } $this->cacheInfrastructures->ajout($infra); }