public function onOrderPreUpdateEvent(ResourceEvent $event)
 {
     $order = $event->getResource();
     if ($order instanceof OrderInterface) {
         $this->removeTotals($order);
         $this->recalculateShippingTotal($order);
         $this->traverseOrder($order);
     }
 }
 public function onClientPostCreate(ResourceEvent $event)
 {
     $client = $event->getResource();
     if ($client instanceof ClientInterface) {
         $email = $client->getContactDetails()->getEmail();
         $title = $this->getTranslatorHelper()->trans('client.email.heading.register');
         $body = $this->getEmailBody($client);
         $shop = $client->getShop();
         $this->getMailerHelper()->sendEmail($email, $title, $body, $shop->getMailerConfiguration());
     }
 }
 public function onUserPreCreate(ResourceEvent $resourceEvent)
 {
     $password = $this->getSecurityHelper()->generateRandomPassword();
     $role = $this->get('role.repository')->findOneByName('admin');
     $user = $resourceEvent->getResource();
     if ($user instanceof UserInterface) {
         $user->addRole($role);
         $user->setPassword($password);
         $email = $user->getEmail();
         $title = $this->getTranslatorHelper()->trans('user.email.title.register');
         $body = $this->getEmailBody($user, $password);
         $shop = $this->get('shop.context.admin')->getCurrentShop();
         $this->getMailerHelper()->sendEmail($email, $title, $body, $shop->getMailerConfiguration());
     }
 }
 /**
  * Sets resource settings fetched from fieldset corresponding to selected box type
  *
  * @param ResourceEvent $event
  */
 public function onLayoutBoxResourceSave(ResourceEvent $event)
 {
     $settings = $this->getBoxSettingsFromRequest($event->getRequest());
     $resource = $event->getResource();
     $resource->setSettings($settings);
 }
 public function onCartChangedEvent(ResourceEvent $event)
 {
     $this->cartVisitorTraverser->traverse($event->getResource());
 }
 public function onOrderPostPreparedEvent(ResourceEvent $event)
 {
     $this->orderVisitorTraverser->traverse($event->getResource());
 }