/**
  * Renvoie les Rivieres liés à la collection
  * @return RiviereCollection
  */
 public function getRivieres()
 {
     if (is_null($this->cacheRivieres)) {
         $this->cacheRivieres = RiviereBusiness::getFromParties($this);
         $this->cacheRivieres->store();
     }
     return $this->cacheRivieres;
 }
Example #2
0
 /**
  * @param Hexa $hexa1
  * @param Hexa $hexa2
  * @return Riviere
  */
 public static function getByHexas(Hexa $hexa1, Hexa $hexa2)
 {
     $index = min($hexa1->getId(), $hexa2->getId()) . '_' . max($hexa1->getId(), $hexa2->getId());
     if (isset(self::$indexByHexas[$index])) {
         return self::$indexByHexas[$index];
     } else {
         $riviere = RiviereBusiness::getEntre2Hexas($hexa1, $hexa2);
         if (is_null($riviere)) {
             self::$indexByHexas[$index] = null;
         } else {
             self::store($riviere);
         }
         return $riviere;
     }
 }
Example #3
0
 /**
  * @return void
  */
 public function delete()
 {
     RiviereBusiness::delete($this);
 }
Example #4
0
 /**
  * Renvoie la rivière qui est sur le côté précisé de la case. null si rien de trouvé
  * @param $angle
  * @return Riviere
  */
 public function riviereCote($angle)
 {
     if (is_null($this->getVoisin($angle))) {
         return null;
     }
     return RiviereBusiness::getEntre2Hexas($this, $this->getVoisin($angle));
 }