allow to delete customer address

This commit is contained in:
Manuel Raynaud
2013-10-03 15:53:30 +02:00
parent c4d8b59b07
commit fa45df3275
7 changed files with 153 additions and 27 deletions

View File

@@ -25,6 +25,7 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\ActionEvent;
use Thelia\Core\Event\Customer\CustomerAddressEvent;
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
use Thelia\Core\Event\Customer\CustomerEvent;
use Thelia\Core\Event\TheliaEvents;
@@ -110,6 +111,15 @@ class Customer extends BaseAction implements EventSubscriberInterface
$this->getSecurityContext()->clearCustomerUser();
}
public function deleteAddress(CustomerAddressEvent $event)
{
$address = $event->getAddress();
$address->delete();
$event->setAddress($address);
}
public function changePassword(ActionEvent $event)
{
// TODO
@@ -148,11 +158,12 @@ class Customer extends BaseAction implements EventSubscriberInterface
public static function getSubscribedEvents()
{
return array(
TheliaEvents::CUSTOMER_CREATEACCOUNT => array("create", 128),
TheliaEvents::CUSTOMER_UPDATEACCOUNT => array("modify", 128),
TheliaEvents::CUSTOMER_LOGOUT => array("logout", 128),
TheliaEvents::CUSTOMER_LOGIN => array("login" , 128),
TheliaEvents::CUSTOMER_DELETEACCOUNT => array("delete", 128),
TheliaEvents::CUSTOMER_CREATEACCOUNT => array('create', 128),
TheliaEvents::CUSTOMER_UPDATEACCOUNT => array('modify', 128),
TheliaEvents::CUSTOMER_LOGOUT => array('logout', 128),
TheliaEvents::CUSTOMER_LOGIN => array('login', 128),
TheliaEvents::CUSTOMER_DELETEACCOUNT => array('delete', 128),
TheliaEvents::CUSTOMER_ADDRESS_DELETE => array('deleteAddress', 128)
);
}
}