Development

/branches/1.1/lib/controller/sfFrontWebController.class.php

You must first sign up to be able to contribute.

root/branches/1.1/lib/controller/sfFrontWebController.class.php

Revision 7792, 1.9 kB (checked in by fabien, 7 years ago)

updated Sean Kerr email address

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Rev Date
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
6  * (c) 2004-2006 Sean Kerr <sean@code-box.org>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 /**
13  * sfFrontWebController allows you to centralize your entry point in your web
14  * application, but at the same time allow for any module and action combination
15  * to be requested.
16  *
17  * @package    symfony
18  * @subpackage controller
19  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
20  * @author     Sean Kerr <sean@code-box.org>
21  * @version    SVN: $Id$
22  */
23 class sfFrontWebController extends sfWebController
24 {
25   /**
26    * Dispatches a request.
27    *
28    * This will determine which module and action to use by request parameters specified by the user.
29    */
30   public function dispatch()
31   {
32     try
33     {
34       if (sfConfig::get('sf_logging_enabled'))
35       {
36         $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Dispatch request')));
37       }
38
39       // reinitialize filters (needed for unit and functional tests)
40       sfFilter::$filterCalled = array();
41
42       // determine our module and action
43       $request    = $this->context->getRequest();
44       $moduleName = $request->getParameter('module');
45       $actionName = $request->getParameter('action');
46
47       if (empty($moduleName) || empty($actionName))
48       {
49         throw new sfError404Exception(sprintf('Empty module and/or action after parsing the URL "%s" (%s/%s).', $request->getPathInfo(), $moduleName, $actionName));
50       }
51
52       // make the first request
53       $this->forward($moduleName, $actionName);
54     }
55     catch (sfException $e)
56     {
57       $e->printStackTrace();
58     }
59     catch (Exception $e)
60     {
61       sfException::createFromException($e)->printStackTrace();
62     }
63   }
64 }
65
Note: See TracBrowser for help on using the browser.