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 e0c0e5ab authored by Nicolas's avatar Nicolas
Browse files

feat: Rename Observer

parent 5fef756a
No related branches found
No related tags found
No related merge requests found
...@@ -7,10 +7,11 @@ use Magento\Framework\Event\Observer; ...@@ -7,10 +7,11 @@ use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface; use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\Exception\NoSuchEntityException;
use NicolasBejean\Customer\Helper\SendGeoLocation;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
* Class SendCustomerDataToElasticsearch * Class SendCustomerData
* *
* @category PHP * @category PHP
* @package NicolasBejean\Customer\Observer * @package NicolasBejean\Customer\Observer
...@@ -18,7 +19,7 @@ use Psr\Log\LoggerInterface; ...@@ -18,7 +19,7 @@ use Psr\Log\LoggerInterface;
* @license https://lab.frogg.it/bejean-developpement/magento-2/modules/customer/-/blob/master/LICENCE GPL3 Licence * @license https://lab.frogg.it/bejean-developpement/magento-2/modules/customer/-/blob/master/LICENCE GPL3 Licence
* @link https://www.bejean.eu * @link https://www.bejean.eu
*/ */
class SendCustomerDataToElasticsearch implements ObserverInterface class SendCustomerData implements ObserverInterface
{ {
/** /**
* @var AccountManagementInterface * @var AccountManagementInterface
...@@ -31,17 +32,25 @@ class SendCustomerDataToElasticsearch implements ObserverInterface ...@@ -31,17 +32,25 @@ class SendCustomerDataToElasticsearch implements ObserverInterface
private LoggerInterface $logger; private LoggerInterface $logger;
/** /**
* SendCustomerDataToElasticsearch constructor. * @var SendGeoLocation
*/
private SendGeoLocation $helper;
/**
* SendCustomerData constructor.
* *
* @param AccountManagementInterface $accountManagement * @param AccountManagementInterface $accountManagement
* @param LoggerInterface $logger * @param LoggerInterface $logger
* @param SendGeoLocation $helper
*/ */
public function __construct( public function __construct(
AccountManagementInterface $accountManagement, AccountManagementInterface $accountManagement,
LoggerInterface $logger LoggerInterface $logger,
SendGeoLocation $helper
) { ) {
$this->accountManagement = $accountManagement; $this->accountManagement = $accountManagement;
$this->logger = $logger; $this->logger = $logger;
$this->helper = $helper;
} }
/** /**
...@@ -65,7 +74,7 @@ class SendCustomerDataToElasticsearch implements ObserverInterface ...@@ -65,7 +74,7 @@ class SendCustomerDataToElasticsearch implements ObserverInterface
} }
if (!is_null($defaultBillingAddress)) { if (!is_null($defaultBillingAddress)) {
/* Send data to Elasticsearch */ $this->helper->sendDataToApi($customer, $defaultBillingAddress);
} }
exit(); exit();
......
<?xml version="1.0"?> <?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="customer_register_success"> <event name="customer_register_success">
<observer name="send_customer_data_to_elasticsearch" instance="NicolasBejean\Customer\Observer\SendCustomerDataToElasticsearch" /> <observer name="send_customer_data" instance="NicolasBejean\Customer\Observer\SendCustomerData" />
</event> </event>
</config> </config>
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