Ejemplo n.º 1
0
 /**
  * Récuparation d'une entité via sa clé primaire
  *
  * @return Model
  */
 public function find($id)
 {
     $statement = QueryBuilder::select("*")->from($this->table)->where("{$this->primaryKey} = :id")->make();
     return $this->fetchOne($statement, compact('id'));
 }
Ejemplo n.º 2
0
 /**
  * Récupération des pistes favorites d'un utilisateur
  *
  * @return array
  */
 public function getFavoritesByUserId($user_id)
 {
     $statement = QueryBuilder::select("{$this->table}.*")->from($this->table)->join("favorites", "favorites.song_id = {$this->table}.{$this->primaryKey}")->where("favorites.user_id = :user_id")->make();
     return $this->fetchAll($statement, compact('user_id'));
 }