Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 75450853 authored by Nicolas's avatar Nicolas
Browse files

Développement de l'observer

parent a083964e
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,10 @@ namespace NicolasBejean\Customer\Observer;
use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Customer\Api\Data\CustomerInterface;
use NicolasBejean\Customer\Helper\SendCustomer;
/**
* Class CustomerRegisterSuccess
*
......@@ -16,11 +20,18 @@ use Magento\Framework\Event\ObserverInterface;
class CustomerRegisterSuccess implements ObserverInterface
{
/**
* CustomerRegisterSuccess constructor.
* @var SendCustomer
*/
public function __construct()
{
protected $sendCustomer;
/**
* CustomerRegisterSuccess constructor.
* @param SendCustomer $sendCustomer
*/
public function __construct(
SendCustomer $sendCustomer
) {
$this->sendCustomer = $sendCustomer;
}
/**
......@@ -30,6 +41,15 @@ class CustomerRegisterSuccess implements ObserverInterface
*/
public function execute(Observer $observer)
{
// TODO: Implement execute() method.
/* Récupère l'événement */
$event = $observer->getEvent();
/* Vérifie si le nom de l'événement est bien celui souhaité */
if ($event->getName() === 'customer_register_success') {
/** @var CustomerInterface $customer */
$customer = $observer->getData('customer');
$this->sendCustomer->execute('frontend', $customer);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment