Example #1
0
 /**
  * Return a Model found in the db checking the array
  * @param String $array
  * @param mixed $value
  * @return \App\Component\Model
  */
 public static function getOneBy($array)
 {
     $object = Database::getOne(self::getCollectionName(), $array);
     if (!$object) {
         return null;
     }
     $className = get_called_class();
     $model = new $className();
     $model->hydrate($object);
     return $model;
 }