# File core/lib/Thelia/Core/Event/ActionEvent.php | thelia

      1: <?php
      2: /*************************************************************************************/
      3: /*                                                                                   */
      4: /*      Thelia                                                                       */
      5: /*                                                                                   */
      6: /*      Copyright (c) OpenStudio                                                     */
      7: /*  email : info@thelia.net                                                      */
      8: /*      web : http://www.thelia.net                                                  */
      9: /*                                                                                   */
     10: /*      This program is free software; you can redistribute it and/or modify         */
     11: /*      it under the terms of the GNU General Public License as published by         */
     12: /*      the Free Software Foundation; either version 3 of the License                */
     13: /*                                                                                   */
     14: /*      This program is distributed in the hope that it will be useful,              */
     15: /*      but WITHOUT ANY WARRANTY; without even the implied warranty of               */
     16: /*      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                */
     17: /*      GNU General Public License for more details.                                 */
     18: /*                                                                                   */
     19: /*      You should have received a copy of the GNU General Public License            */
     20: /*      along with this program. If not, see <http://www.gnu.org/licenses/>.     */
     21: /*                                                                                   */
     22: /*************************************************************************************/
     23:
     24: namespace Thelia\Core\Event;
     25:
     26: use Symfony\Component\EventDispatcher\Event;
     27: use Symfony\Component\HttpFoundation\Request;
     28: /**
     29:  *
     30:  * Class thrown on Thelia.action event
     31:  *
     32:  * call setAction if action match yours
     33:  *
     34:  */
     35: class ActionEvent extends Event
     36: {
     37:
     38:     /**
     39:      *
     40:      * @var Symfony\Component\HttpFoundation\Request
     41:      */
     42:     protected $request;
     43:
     44:     /**
     45:      *
     46:      * @var string
     47:      */
     48:     protected $action;
     49:
     50:     /**
     51:      *
     52:      * @var string
     53:      */
     54:     protected $controller;
     55:
     56:     /**
     57:      *
     58:      * @param \Symfony\Component\HttpFoundation\Request $request
     59:      * @param string $action
     60:      */
     61:     public function __construct(Request $request, $action) {
     62:         $this->request = $request;
     63:         $this->action = $action;
     64:     }
     65:
     66:     /**
     67:      *
     68:      * @return string
     69:      */
     70:     public function getAction()
     71:     {
     72:         return $this->action;
     73:     }
     74:
     75:     /**
     76:      *
     77:      * @return \Symfony\Component\HttpFoundation\Request
     78:      */
     79:     public function getRequest()
     80:     {
     81:         return $this->request;
     82:     }
     83:
     84:     /**
     85:      *
     86:      * @param string $controller
     87:      */
     88:     public function setController($controller)
     89:     {
     90:         $this->controller = $controller;
     91:     }
     92:
     93:     public function getController()
     94:     {
     95:         return $this->controller;
     96:     }
     97:
     98:     public function hasController()
     99:     {
    100:         return null !== $this->controller;
    101:     }
    102:
    103:
    104: }
    105: