-
Notifications
You must be signed in to change notification settings - Fork 115
Expand file tree
/
Copy pathSaveBefore.php
More file actions
34 lines (30 loc) · 828 Bytes
/
SaveBefore.php
File metadata and controls
34 lines (30 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Ebizmarts\MailChimp\Observer\Subscriber;
use Magento\Framework\Event\Observer;
use Magento\Customer\Model\Session;
class SaveBefore implements \Magento\Framework\Event\ObserverInterface
{
/**
* @var Session
*/
private $customerSession;
/**
* @param Session $customerSession
*/
public function __construct(
Session $customerSession
)
{
$this->customerSession = $customerSession;
}
public function execute(Observer $observer)
{
// TODO: Implement execute() method.
$subscriber = $observer->getSubscriber();
if ($this->customerSession->getPhone()) {
$subscriber->setPhone($this->customerSession->getPhone());
$this->customerSession->unsPhone();
}
return $subscriber;
}
}