Beispiel #1
0
 /**
  * [handle description]
  *
  * @param  CartRepository $repository
  *
  * @return Cart
  */
 public function handle(CartRepository $repository, InventoryItemRepository $itemRepository)
 {
     $inventoryItem = $itemRepository->get($this->item_id);
     $cart = $repository->get($this->cart_id);
     Assertion::notNull($cart, 'Invalid shopping cart');
     Assertion::notNull($inventoryItem, 'Invalid item to purchase');
     $item = $cart->addItem($inventoryItem, $this->quantity);
     $repository->update($cart);
     return $item;
 }
 /**
  * [handle description]
  *
  * @param  EntityManager $em
  *
  * @return User
  */
 public function handle(ItemRepository $repository)
 {
     return $repository->all();
 }
Beispiel #3
0
 /**
  * [handle description]
  *
  * @param  UserRepository $repository
  *
  * @return User
  */
 public function handle(ItemRepository $repository)
 {
     $item = $repository->get($this->id);
     Assertion::entityExists($item, "Item with ID '{$this->id}' not found");
     return $item;
 }
 public function handle(ItemRepository $repository)
 {
     $item = new Item(new Title($this->title), new Description($this->description), new Price((double) $this->price), new Quantity((int) $this->quantity));
     $repository->create($item);
     return $item;
 }