/**
  * Dit si l'objet existe dans la collection
  * @param Bean $bean
  * @return bool
  */
 public function exists(Bean $bean)
 {
     foreach ($this as $obj) {
         /** @var Bean $obj */
         if ($obj->getId() == $bean->getId()) {
             return true;
         }
     }
     return false;
 }
 /**
  * Supprime l'objet en base
  * @param Bean $bean
  */
 public static function delete(Bean $bean)
 {
     $req = "DELETE FROM `" . static::$table . "` WHERE " . static::$fields[0] . " = " . $bean->getId() . ";";
     DbHandler::update($req);
 }
Exemple #3
0
 /**
  * Store l'objet
  * @param Bean $obj
  */
 public static function store(Bean $obj)
 {
     self::$stock[static::$table][$obj->getId()] = $obj;
 }