allow address removal from front
This commit is contained in:
@@ -26,6 +26,7 @@ use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Propel;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Thelia\Core\Event\AddressCreateOrUpdateEvent;
|
||||
use Thelia\Core\Event\AddressEvent;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
use Thelia\Model\Address as AddressModel;
|
||||
use Thelia\Model\Map\AddressTableMap;
|
||||
@@ -52,6 +53,13 @@ class Address extends BaseAction implements EventSubscriberInterface
|
||||
$this->createOrUpdate($addressModel, $event);
|
||||
}
|
||||
|
||||
public function delete(AddressEvent $event)
|
||||
{
|
||||
$address = $event->getAddress();
|
||||
|
||||
$address->delete();
|
||||
}
|
||||
|
||||
protected function createOrUpdate(AddressModel $addressModel, AddressCreateOrUpdateEvent $event)
|
||||
{
|
||||
$addressModel->setDispatcher($this->getDispatcher());
|
||||
@@ -116,7 +124,8 @@ class Address extends BaseAction implements EventSubscriberInterface
|
||||
{
|
||||
return array(
|
||||
TheliaEvents::ADDRESS_CREATE => array("create", 128),
|
||||
TheliaEvents::ADDRESS_UPDATE => array("update", 128)
|
||||
TheliaEvents::ADDRESS_UPDATE => array("update", 128),
|
||||
TheliaEvents::ADDRESS_DELETE => array("delete", 128)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user