/** * @param ResourceEvent $event */ public function preRegister(ResourceEvent $event) { $item = $event->getSubject(); /** @var Store $store */ $store = $this->factory->createNew(); $store->setName($item->getEmail()); $store->setCode($item->getEmail()); $store->setEnabled(true); $item->getUser()->setStore($store); }
private function addItem(ProductInterface $product, $quantity, OrderInterface $cart) { /** @var OrderItemInterface $item */ $item = $this->orderItemFactory->createNew(); $item->setUnitPrice($product->getPrice()); $item->setProduct($product); $this->modifier->modify($item, $quantity); $event = new CartItemEvent($cart, $item); $this->eventDispatcher->dispatch(SyliusCartEvents::ITEM_ADD_INITIALIZE, $event); $this->eventDispatcher->dispatch(SyliusCartEvents::CART_CHANGE, new GenericEvent($cart)); $this->eventDispatcher->dispatch(SyliusCartEvents::CART_SAVE_INITIALIZE, $event); $this->eventDispatcher->dispatch(SyliusCartEvents::ITEM_ADD_COMPLETED, new FlashEvent()); }
public function __construct($className, ItemTypeFactory $itemTypeFactory) { parent::__construct($className); $this->itemTypeFactory = $itemTypeFactory; }
public function __construct($className, $mediaPath, EntityManagerInterface $entityManager) { parent::__construct($className); $this->mediaPath = $mediaPath; $this->entityManager = $entityManager; }
public function __construct($className, FileFactory $fileFactory) { parent::__construct($className); $this->fileFactory = $fileFactory; }
/** * WishlistFactory constructor. * * @param $className * @param TranslatorInterface $translator * @param $defaultPublic */ public function __construct($className, TranslatorInterface $translator, $defaultPublic) { parent::__construct($className); $this->translator = $translator; $this->defaultPublic = $defaultPublic; }