create all area events

This commit is contained in:
Manuel Raynaud
2013-10-11 12:06:17 +02:00
parent 275262c7dc
commit 319bb2f0b8
4 changed files with 148 additions and 4 deletions

View File

@@ -22,7 +22,10 @@
/*************************************************************************************/
namespace Thelia\Controller\Admin;
use Thelia\Core\Event\Area\AreaCreateEvent;
use Thelia\Core\Event\Area\AreaUpdateEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Form\Area\AreaCreateForm;
/**
* Class AreaController
@@ -67,7 +70,7 @@ class AreaController extends AbstractCrudController
*/
protected function getCreationForm()
{
// TODO: Implement getCreationForm() method.
return new AreaCreateForm($this->getRequest());
}
/**
@@ -75,7 +78,7 @@ class AreaController extends AbstractCrudController
*/
protected function getUpdateForm()
{
// TODO: Implement getUpdateForm() method.
return new AreaCreateForm($this->getRequest());
}
/**
@@ -92,10 +95,14 @@ class AreaController extends AbstractCrudController
* Creates the creation event with the provided form data
*
* @param unknown $formData
*
* @return \Thelia\Core\Event\Area\AreaCreateEvent
*/
protected function getCreationEvent($formData)
{
// TODO: Implement getCreationEvent() method.
$event = new AreaCreateEvent();
return $this->hydrateEvent($event, $formData);
}
/**
@@ -105,7 +112,16 @@ class AreaController extends AbstractCrudController
*/
protected function getUpdateEvent($formData)
{
// TODO: Implement getUpdateEvent() method.
$event = new AreaUpdateEvent();
return $this->hydrateEvent($event, $formData);
}
private function hydrateEvent($event, $formData)
{
$event->setName($formData['name']);
return $event;
}
/**

View File

@@ -0,0 +1,53 @@
<?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;
/**
* Class AreaCreateEvent
* @package Thelia\Core\Event\Area
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class AreaCreateEvent extends AreaEvent
{
protected $name;
/**
* @param mixed $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
}

View File

@@ -0,0 +1,40 @@
<?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;
/**
* Class AreaDeleteEvent
* @package Thelia\Core\Event\Area
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class AreaDeleteEvent extends AreaEvent
{
protected $area_id;
public function __construct($area_id)
{
$this->area_id = $area_id;
}
}

View File

@@ -0,0 +1,35 @@
<?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;
/**
* Class AreaUpdateEvent
* @package Thelia\Core\Event\Area
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class AreaUpdateEvent extends AreaCreateEvent
{
}