start to implement action controller.
This commit is contained in:
@@ -101,6 +101,11 @@ class TheliaBundle extends Bundle
|
||||
->addMethodCall('addSubscriber', array(new Reference('listener.router')))
|
||||
->addMethodCall('addSubscriber', array(new Reference('thelia.listener.view')))
|
||||
;
|
||||
|
||||
|
||||
// TODO : save listener from plugins
|
||||
|
||||
$container->getDefinition('matcher.action')->addMethodCall("setDispatcher", array(new Reference('dispatcher')));
|
||||
|
||||
$container->register('http_kernel','Thelia\Core\TheliaHttpKernel')
|
||||
->addArgument(new Reference('dispatcher'))
|
||||
|
||||
104
core/lib/Thelia/Core/Event/ActionEvent.php
Normal file
104
core/lib/Thelia/Core/Event/ActionEvent.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?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;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
/**
|
||||
*
|
||||
* Class thrown on Thelia.action event
|
||||
*
|
||||
* call setAction if action match yours
|
||||
*
|
||||
*/
|
||||
class ActionEvent extends Event
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Symfony\Component\HttpFoundation\Request
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $action;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $controller;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Symfony\Component\HttpFoundation\Request $request
|
||||
* @param string $action
|
||||
*/
|
||||
public function __construct(Request $request, $action) {
|
||||
$this->request = $request;
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAction()
|
||||
{
|
||||
return $this->action;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Symfony\Component\HttpFoundation\Request
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
return $this->request;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $controller
|
||||
*/
|
||||
public function setController($controller)
|
||||
{
|
||||
$this->controller = $controller;
|
||||
}
|
||||
|
||||
public function getController()
|
||||
{
|
||||
return $this->controller;
|
||||
}
|
||||
|
||||
public function hasController()
|
||||
{
|
||||
return null !== $this->controller;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
43
core/lib/Thelia/Core/Event/TheliaEvents.php
Normal file
43
core/lib/Thelia/Core/Event/TheliaEvents.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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 containing all Thelia events name using in Thelia Core
|
||||
*
|
||||
*
|
||||
* @author Manuel Raynaud <mraynaud@openstudio.fr>
|
||||
*/
|
||||
|
||||
final class TheliaEvents
|
||||
{
|
||||
|
||||
/**
|
||||
* ACTION event
|
||||
*
|
||||
* Send if no action are already present in Thelia action process ( see Thelia\Routing\Matcher\ActionMatcher)
|
||||
*/
|
||||
const ACTION = "thelia.action";
|
||||
}
|
||||
Reference in New Issue
Block a user