icreate folder delete event
This commit is contained in:
@@ -208,6 +208,10 @@
|
|||||||
<default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateAction</default>
|
<default key="_controller">Thelia\Controller\Admin\FolderController::processUpdateAction</default>
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<route id="admin.categories.delete" path="/admin/folders/delete">
|
||||||
|
<default key="_controller">Thelia\Controller\Admin\FolderController::deleteAction</default>
|
||||||
|
</route>
|
||||||
|
|
||||||
<!-- Route to the Coupon controller (process Coupon browsing) -->
|
<!-- Route to the Coupon controller (process Coupon browsing) -->
|
||||||
|
|
||||||
<route id="admin.coupon.list" path="/admin/coupon/">
|
<route id="admin.coupon.list" path="/admin/coupon/">
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
|
|
||||||
namespace Thelia\Controller\Admin;
|
namespace Thelia\Controller\Admin;
|
||||||
|
use Thelia\Core\Event\FolderDeleteEvent;
|
||||||
use Thelia\Core\Event\FolderUpdateEvent;
|
use Thelia\Core\Event\FolderUpdateEvent;
|
||||||
use Thelia\Core\Event\TheliaEvents;
|
use Thelia\Core\Event\TheliaEvents;
|
||||||
use Thelia\Form\FolderModificationForm;
|
use Thelia\Form\FolderModificationForm;
|
||||||
@@ -133,7 +134,7 @@ class FolderController extends AbstractCrudController
|
|||||||
*/
|
*/
|
||||||
protected function getDeleteEvent()
|
protected function getDeleteEvent()
|
||||||
{
|
{
|
||||||
// TODO: Implement getDeleteEvent() method.
|
return new FolderDeleteEvent($this->getRequest()->get('folder_id'), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -149,11 +150,13 @@ class FolderController extends AbstractCrudController
|
|||||||
/**
|
/**
|
||||||
* Get the created object from an event.
|
* Get the created object from an event.
|
||||||
*
|
*
|
||||||
* @param unknown $createEvent
|
* @param $event \Thelia\Core\Event\FolderEvent $event
|
||||||
|
*
|
||||||
|
* @return null|\Thelia\Model\Folder
|
||||||
*/
|
*/
|
||||||
protected function getObjectFromEvent($event)
|
protected function getObjectFromEvent($event)
|
||||||
{
|
{
|
||||||
// TODO: Implement getObjectFromEvent() method.
|
return $event->hasFolder() ? $event->getFolder() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -235,6 +238,12 @@ class FolderController extends AbstractCrudController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put in this method post object delete processing if required.
|
||||||
|
*
|
||||||
|
* @param \Thelia\Core\Event\FolderDeleteEvent $deleteEvent the delete event
|
||||||
|
* @return Response a response, or null to continue normal processing
|
||||||
|
*/
|
||||||
protected function performAdditionalDeleteAction($deleteEvent)
|
protected function performAdditionalDeleteAction($deleteEvent)
|
||||||
{
|
{
|
||||||
// Redirect to parent category list
|
// Redirect to parent category list
|
||||||
|
|||||||
64
core/lib/Thelia/Core/Event/FolderDeleteEvent.php
Normal file
64
core/lib/Thelia/Core/Event/FolderDeleteEvent.php
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class FolderDeleteEvent
|
||||||
|
* @package Thelia\Core\Event
|
||||||
|
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||||
|
*/
|
||||||
|
class FolderDeleteEvent extends FolderEvent{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int folder id
|
||||||
|
*/
|
||||||
|
protected $folder_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $folder_id
|
||||||
|
*/
|
||||||
|
function __construct($folder_id)
|
||||||
|
{
|
||||||
|
$this->folder_id = $folder_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $folder_id
|
||||||
|
*/
|
||||||
|
public function setFolderId($folder_id)
|
||||||
|
{
|
||||||
|
$this->folder_id = $folder_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getFolderId()
|
||||||
|
{
|
||||||
|
return $this->folder_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -60,6 +60,11 @@ class FolderEvent extends ActionEvent {
|
|||||||
return $this->folder;
|
return $this->folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test if a folder object exists
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function hasFolder()
|
public function hasFolder()
|
||||||
{
|
{
|
||||||
return null !== $this->folder;
|
return null !== $this->folder;
|
||||||
|
|||||||
Reference in New Issue
Block a user