/** * Creates a Game object based on a DB row. * * @param array $row The DB row containing Game data. * @return \LudusVisualis\Domain\Game */ protected function buildDomainObject(array $row) { $game = new Game(); $game->setId($row['game_id']); $game->setName($row['game_name']); $game->setDescriptionShort($row['game_description_short']); $game->setDescriptionLong($row['game_description_long']); $game->setAuthor($row['game_author']); $game->setYear($row['game_year']); $game->setImage($row['game_image']); $game->setType($row['game_type']); $game->setPrice($row['game_price']); $game->setNumber($row['game_number']); return $game; }
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); }