Пример #1
0
 public function deserialize(array $data)
 {
     $cart = new Cart();
     foreach ($data['rows'] as $id => $row) {
         $meal = $this->manager->getRepository('AppBundle:Meal')->find($id);
         if (!$meal) {
             continue;
         }
         $row = new CartRow($meal, $row['quantity']);
         $cart->addRow($row);
     }
     return $cart;
 }
Пример #2
0
 public function loadFromCart(Cart $cart)
 {
     $this->order = $cart->toArray();
 }