redirect to customer update template after removing address
This commit is contained in:
@@ -111,15 +111,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
|||||||
$this->getSecurityContext()->clearCustomerUser();
|
$this->getSecurityContext()->clearCustomerUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteAddress(CustomerAddressEvent $event)
|
|
||||||
{
|
|
||||||
$address = $event->getAddress();
|
|
||||||
|
|
||||||
$address->delete();
|
|
||||||
|
|
||||||
$event->setAddress($address);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function changePassword(ActionEvent $event)
|
public function changePassword(ActionEvent $event)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
@@ -163,7 +154,6 @@ class Customer extends BaseAction implements EventSubscriberInterface
|
|||||||
TheliaEvents::CUSTOMER_LOGOUT => array('logout', 128),
|
TheliaEvents::CUSTOMER_LOGOUT => array('logout', 128),
|
||||||
TheliaEvents::CUSTOMER_LOGIN => array('login', 128),
|
TheliaEvents::CUSTOMER_LOGIN => array('login', 128),
|
||||||
TheliaEvents::CUSTOMER_DELETEACCOUNT => array('delete', 128),
|
TheliaEvents::CUSTOMER_DELETEACCOUNT => array('delete', 128),
|
||||||
TheliaEvents::CUSTOMER_ADDRESS_DELETE => array('deleteAddress', 128)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,9 +246,9 @@ class BaseAdminController extends BaseController
|
|||||||
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
|
* @param unknown $routeId the route ID, as found in Config/Resources/routing/admin.xml
|
||||||
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
|
* @param unknown $urlParameters the URL parametrs, as a var/value pair array
|
||||||
*/
|
*/
|
||||||
public function redirectToRoute($routeId, $urlParameters = array())
|
public function redirectToRoute($routeId, $urlParameters = array(), $routeParameters = array())
|
||||||
{
|
{
|
||||||
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId), $urlParameters));
|
$this->redirect(URL::getInstance()->absoluteUrl($this->getRoute($routeId, $routeParameters), $urlParameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace Thelia\Controller\Admin;
|
|||||||
|
|
||||||
use Propel\Runtime\Exception\PropelException;
|
use Propel\Runtime\Exception\PropelException;
|
||||||
use Symfony\Component\Form\Form;
|
use Symfony\Component\Form\Form;
|
||||||
|
use Thelia\Core\Event\Address\AddressEvent;
|
||||||
use Thelia\Core\Event\Customer\CustomerAddressEvent;
|
use Thelia\Core\Event\Customer\CustomerAddressEvent;
|
||||||
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
use Thelia\Core\Event\Customer\CustomerCreateOrUpdateEvent;
|
||||||
use Thelia\Core\Event\Customer\CustomerEvent;
|
use Thelia\Core\Event\Customer\CustomerEvent;
|
||||||
@@ -69,18 +70,16 @@ class CustomerController extends BaseAdminController
|
|||||||
throw new \InvalidArgumentException(sprintf('%d address does not exists', $address_id));
|
throw new \InvalidArgumentException(sprintf('%d address does not exists', $address_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
$addressEvent = new CustomerAddressEvent($address);
|
$addressEvent = new AddressEvent($address);
|
||||||
|
|
||||||
$this->dispatch(TheliaEvents::CUSTOMER_ADDRESS_DELETE, $addressEvent);
|
$this->dispatch(TheliaEvents::ADDRESS_DELETE, $addressEvent);
|
||||||
|
|
||||||
$this->adminLogAppend(sprintf("address %d for customer %d removal", $address_id, $address->getCustomerId()));
|
$this->adminLogAppend(sprintf("address %d for customer %d removal", $address_id, $address->getCustomerId()));
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during address removal with message %s", $e->getMessage()));
|
\Thelia\Log\Tlog::getInstance()->error(sprintf("error during address removal with message %s", $e->getMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render("customer-edit", array(
|
$this->redirectToRoute('admin.customer.update.view', array(), array('customer_id' => $address->getCustomerId()));
|
||||||
"customer_id" => $address->getCustomerId()
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*************************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* Thelia */
|
|
||||||
/* */
|
|
||||||
/* Copyright (c) OpenStudio */
|
|
||||||
/* email : info@thelia.net */
|
|
||||||
/* web : http://www.thelia.net */
|
|
||||||
/* */
|
|
||||||
/* This program is free software; you can redistribute it and/or modify */
|
|
||||||
/* it under the terms of the GNU General Public License as published by */
|
|
||||||
/* the Free Software Foundation; either version 3 of the License */
|
|
||||||
/* */
|
|
||||||
/* This program is distributed in the hope that it will be useful, */
|
|
||||||
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
|
||||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
|
||||||
/* GNU General Public License for more details. */
|
|
||||||
/* */
|
|
||||||
/* You should have received a copy of the GNU General Public License */
|
|
||||||
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
||||||
/* */
|
|
||||||
/*************************************************************************************/
|
|
||||||
|
|
||||||
namespace Thelia\Core\Event\Customer;
|
|
||||||
|
|
||||||
use Thelia\Core\Event\ActionEvent;
|
|
||||||
use Thelia\Model\Address;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CustomerAddressEvent
|
|
||||||
* @package Thelia\Core\Event\Customer
|
|
||||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
|
||||||
*/
|
|
||||||
class CustomerAddressEvent extends ActionEvent
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var \Thelia\Model\Address
|
|
||||||
*/
|
|
||||||
protected $address;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Address $address
|
|
||||||
*/
|
|
||||||
public function __construct(Address $address)
|
|
||||||
{
|
|
||||||
$this->address = $address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \Thelia\Model\Address $address
|
|
||||||
*/
|
|
||||||
public function setAddress($address)
|
|
||||||
{
|
|
||||||
$this->address = $address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Thelia\Model\Address
|
|
||||||
*/
|
|
||||||
public function getAddress()
|
|
||||||
{
|
|
||||||
return $this->address;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user