/** * Does the user owns this restaurant * * @param \Tycoon\ApiBundle\Entity\Restaurant $restaurant * * @return boolean */ public function orderedInRestaurant($restaurant) { if (empty($this->restaurantIds)) { foreach ($this->getOrderRestaurants() as $orderRestaurant) { $this->orderRestaurantIds[] = $orderRestaurant->getId(); } } return in_array($restaurant->getId(), $this->orderRestaurantIds); }
/** * Set restaurant * * @param \Tycoon\ApiBundle\Entity\Restaurant $restaurant * @return UserRestaurant */ public function setRestaurant(\Tycoon\ApiBundle\Entity\Restaurant $restaurant = null) { $this->restaurant = $restaurant; $this->initialPrice = $restaurant->getPrice(); return $this; }