/**
  * @param Qg $qg
  * @return QgCollection|Qg[]
  * @throws Exception
  */
 public static function getQgsOnSamePosition(Qg $qg)
 {
     $ret = new QgCollection();
     if (!isset(self::$indexParHexa[$qg->getPosition()->getId()])) {
         return $ret;
     }
     if (!isset(self::$indexParHexa[$qg->getPosition()->getId()][$qg->getId()])) {
         throw new Exception("Qg not indexed : " . $qg->getId());
     }
     foreach (self::$indexParHexa[$qg->getPosition()->getId()] as $autreQg) {
         /** @var Qg $autreQg */
         if ($autreQg->getId() != $qg->getId()) {
             $ret->ajout($autreQg);
         }
     }
     return $ret;
 }
 /**
  * @param Qg $qg1
  * @param Qg $qg2
  * @return string
  */
 private static function idDejaFait(Qg $qg1, Qg $qg2)
 {
     return min($qg1->getId(), $qg2->getId()) . '_' . max($qg1->getId(), $qg2->getId());
 }
Exemple #3
0
 /**
  * Enlève le Qg du store
  * @param Qg $qg
  */
 public static function unstore(Qg $qg)
 {
     if (self::exists($qg->getId())) {
         unset(self::$stock[static::$table][$qg->getId()]);
     }
 }
 /**
  * Renvoie les unités en cours de transfert vers le Qg fourni en paramètre
  * @param Qg $qg
  * @return UniteCollection
  */
 public static function getUnitesEnTransfertVersQg(Qg $qg)
 {
     $req = "SELECT * from unite WHERE idQgTransfert='" . $qg->getId() . "';";
     return DbHandler::collFromQuery($req, 'Unite', 'UniteCollection');
 }