refactor shipping object into area
This commit is contained in:
@@ -120,8 +120,8 @@
|
||||
|
||||
<form name="thelia.admin.profile.modification" class="Thelia\Form\ProfileModificationForm"/>
|
||||
|
||||
<form name="thelia.admin.shipping.create" class="Thelia\Form\Shipping\ShippingCreateForm"/>
|
||||
<form name="thelia.admin.shipping.modification" class="Thelia\Form\Shipping\ShippingModificationForm"/>
|
||||
<form name="thelia.admin.area.create" class="Thelia\Form\Shipping\AreaCreateForm"/>
|
||||
<form name="thelia.admin.area.modification" class="Thelia\Form\Shipping\AreaModificationForm"/>
|
||||
|
||||
</forms>
|
||||
|
||||
|
||||
@@ -688,11 +688,11 @@
|
||||
<!-- Shipping zones routes management -->
|
||||
|
||||
<route id="admin.configuration.shipping-configuration.default" path="/admin/configuration/shipping_configuration">
|
||||
<default key="_controller">Thelia\Controller\Admin\ShippingConfigurationController::defaultAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\AreaController::defaultAction</default>
|
||||
</route>
|
||||
|
||||
<route id="admin.configuration.shipping-configuration.update.view" path="/admin/configuration/shipping_configuration/update/{shipping_configuration_id}" methods="get">
|
||||
<default key="_controller">Thelia\Controller\Admin\ShippingConfigurationController::updateAction</default>
|
||||
<default key="_controller">Thelia\Controller\Admin\AreaController::updateAction</default>
|
||||
<requirement key="shipping_configuration_id">\d+</requirement>
|
||||
</route>
|
||||
|
||||
|
||||
@@ -25,11 +25,11 @@ namespace Thelia\Controller\Admin;
|
||||
use Thelia\Core\Event\TheliaEvents;
|
||||
|
||||
/**
|
||||
* Class ShippingConfigurationController
|
||||
* Class AreaController
|
||||
* @package Thelia\Controller\Admin
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class ShippingConfigurationController extends AbstractCrudController
|
||||
class AreaController extends AbstractCrudController
|
||||
{
|
||||
/* public function indexAction()
|
||||
{
|
||||
@@ -51,14 +51,14 @@ class ShippingConfigurationController extends AbstractCrudController
|
||||
null,
|
||||
null,
|
||||
|
||||
'admin.shipping.default',
|
||||
'admin.shipping.create',
|
||||
'admin.shipping.update',
|
||||
'admin.shipping.delete',
|
||||
'admin.area.default',
|
||||
'admin.area.create',
|
||||
'admin.area.update',
|
||||
'admin.area.delete',
|
||||
|
||||
TheliaEvents::SHIPPING_CREATE,
|
||||
TheliaEvents::SHIPPING_UPDATE,
|
||||
TheliaEvents::SHIPPING_DELETE
|
||||
TheliaEvents::AREA_CREATE,
|
||||
TheliaEvents::AREA_UPDATE,
|
||||
TheliaEvents::AREA_DELETE
|
||||
);
|
||||
}
|
||||
|
||||
66
core/lib/Thelia/Core/Event/Area/AreaEvent.php
Normal file
66
core/lib/Thelia/Core/Event/Area/AreaEvent.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?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\Area;
|
||||
use Thelia\Core\Event\ActionEvent;
|
||||
|
||||
|
||||
/**
|
||||
* Class AreaEvent
|
||||
* @package Thelia\Core\Event\Shipping
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class AreaEvent extends ActionEvent
|
||||
{
|
||||
protected $area;
|
||||
|
||||
public function __construct($area = null)
|
||||
{
|
||||
$this->area = $area;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $area
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setArea($area)
|
||||
{
|
||||
$this->area = $area;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getArea()
|
||||
{
|
||||
return $this->area;
|
||||
}
|
||||
|
||||
public function hasArea()
|
||||
{
|
||||
return null !== $this->area;
|
||||
}
|
||||
}
|
||||
@@ -234,9 +234,9 @@ final class TheliaEvents
|
||||
|
||||
// -- SHIPPING CONFIGURATION MANAGEMENT
|
||||
|
||||
const SHIPPING_CREATE = 'action.createShipping';
|
||||
const SHIPPING_UPDATE = 'action.updateShipping';
|
||||
const SHIPPING_DELETE = 'action.deleteShipping';
|
||||
const AREA_CREATE = 'action.createArea';
|
||||
const AREA_UPDATE = 'action.updateArea';
|
||||
const AREA_DELETE = 'action.deleteArea';
|
||||
|
||||
// -- Categories Associated Content ----------------------------------------
|
||||
|
||||
|
||||
@@ -21,18 +21,18 @@
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Form\Shipping;
|
||||
namespace Thelia\Form\Area;
|
||||
use Thelia\Core\Translation\Translator;
|
||||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||||
use Thelia\Form\BaseForm;
|
||||
|
||||
|
||||
/**
|
||||
* Class ShippingCreateForm
|
||||
* Class AreaCreateForm
|
||||
* @package Thelia\Form\Shipping
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class ShippingCreateForm extends BaseForm
|
||||
class AreaCreateForm extends BaseForm
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -74,6 +74,6 @@ class ShippingCreateForm extends BaseForm
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'thelia_shipping_creation';
|
||||
return 'thelia_area_creation';
|
||||
}
|
||||
}
|
||||
@@ -21,16 +21,17 @@
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Form\Shipping;
|
||||
namespace Thelia\Form\Area;
|
||||
use Symfony\Component\Validator\Constraints\GreaterThan;
|
||||
use Thelia\Form\Area\AreaCreateForm;
|
||||
|
||||
|
||||
/**
|
||||
* Class ShippingModificationForm
|
||||
* Class AreaModificationForm
|
||||
* @package Thelia\Form\Shipping
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
class ShippingModificationForm extends ShippingCreateForm
|
||||
class AreaModificationForm extends AreaCreateForm
|
||||
{
|
||||
public function buildForm()
|
||||
{
|
||||
@@ -43,6 +44,6 @@ class ShippingModificationForm extends ShippingCreateForm
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'thelia_shipping_modification';
|
||||
return 'thelia_area_modification';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user