예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function release(StockableInterface $stockable, $quantity)
 {
     if ($quantity < 0) {
         throw new \InvalidArgumentException('Quantity of units must be greater than 0.');
     }
     $this->eventDispatcher->dispatch(SyliusStockableEvents::PRE_RELEASE, new GenericEvent($stockable));
     $stockable->setOnHold($stockable->getOnHold() - $quantity);
     $this->eventDispatcher->dispatch(SyliusStockableEvents::POST_RELEASE, new GenericEvent($stockable));
 }