/** return the number * **/ public function removeOne(Game $game) { $db = $this->getDb(); $sql = "UPDATE videogames Set game_number=game_number-1 WHERE game_id = :gameId"; $success = $db->prepare($sql)->execute(['gameId' => $game->getId()]); return $success; }
public function existsInBasket(Game $game, User $user) { $sql = "SELECT 1 FROM Basket WHERE game_id= :gameId and user_id= :userId"; $result = $this->getDb()->fetchAll($sql, array('gameId' => $game->getId(), 'userId' => $user->getId())); return !empty($result); }