/**
  * Renvoie les Infrastructures liés aux Productions de cette collection
  * @return InfrastructureCollection
  */
 public function getInfrastructures()
 {
     if (is_null($this->cacheInfrastructures)) {
         $this->cacheInfrastructures = InfrastructureBusiness::getFromProductions($this);
         $this->cacheInfrastructures->store();
     }
     return $this->cacheInfrastructures;
 }
 /**
  * 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;
 }
 /**
  * Renvoie les Productions liés aux Infrastructures de la collection fournie en paramètre
  * @param InfrastructureCollection $infrastructures
  * @return ProductionCollection
  */
 public static function getFromInfrastructures(InfrastructureCollection $infrastructures)
 {
     $ids = $infrastructures->getIdsStr();
     if (!$ids) {
         return new ProductionCollection();
     }
     $req = "SELECT * FROM production WHERE idInfrastructure IN (" . $ids . ");";
     return DbHandler::collFromQuery($req, 'Production', 'ProductionCollection');
 }
Example #4
0
 /**
  * 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);
 }