remove ActionEvent search className

This commit is contained in:
Manuel Raynaud
2013-05-21 17:27:33 +02:00
parent 4f42e2cef2
commit 24535d872c
2 changed files with 5 additions and 62 deletions

View File

@@ -1,53 +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;
use Symfony\Component\EventDispatcher\Event;
class ActionEventClass extends Event
{
protected $className;
protected $action;
public function __construct($action)
{
$this->action = $action;
}
public function setClassName($className)
{
$this->className = $className;
}
public function hasClassName()
{
return $this->className !== null;
}
public function getClassName()
{
return $this->className;
}
}

View File

@@ -34,6 +34,11 @@ class ActionEventFactory
protected $action;
protected $dispatcher;
/**
* @todo : delegate to config for creating associating value
*
* @var array
*/
protected $className = array(
"addArticle" => "Thelia\Core\Event\CartEvent",
"deleteArticle" => "Thelia\Core\Event\CartEvent",
@@ -57,15 +62,6 @@ class ActionEventFactory
// return $class->newInstance($this->request, $this->action);
} else {
$actionEventClass = new ActionEventClass($this->action);
$this->dispatcher->dispatch("action.searchClass", $actionEventClass);
if ($actionEventClass->hasClassName()) {
$class = new \ReflectionClass($actionEventClass->getClassName());
}
}
if (is_null($class)) {
$class = new \ReflectionClass($this->defaultClassName);
}