NewAutomation.php 988 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace Dotdigitalgroup\Email\Observer\Customer;
  3. /**
  4. * Register new customer automation.
  5. */
  6. class NewAutomation implements \Magento\Framework\Event\ObserverInterface
  7. {
  8. /**
  9. * @var \Dotdigitalgroup\Email\Model\Automation
  10. */
  11. private $automation;
  12. /**
  13. * NewAutomation constructor.
  14. *
  15. * @param \Dotdigitalgroup\Email\Model\Automation $automation
  16. */
  17. public function __construct(
  18. \Dotdigitalgroup\Email\Model\Automation $automation
  19. ) {
  20. $this->automation = $automation;
  21. }
  22. /**
  23. * If it's configured to capture on shipment - do this.
  24. *
  25. * @param \Magento\Framework\Event\Observer $observer
  26. *
  27. * @return $this
  28. */
  29. public function execute(\Magento\Framework\Event\Observer $observer)
  30. {
  31. $customer = $observer->getEvent()->getCustomer();
  32. //New Automation enrolment to queue
  33. $this->automation->newCustomerAutomation($customer);
  34. return $this;
  35. }
  36. }