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; }
public function loadFromCart(Cart $cart) { $this->order = $cart->toArray(); }