sfContext::getEventDispatcher PHP Method

getEventDispatcher() public method

Retrieves the current event dispatcher.
public getEventDispatcher ( ) : sfEventDispatcher
return sfEventDispatcher An sfEventDispatcher instance
    public function getEventDispatcher()
    {
        return $this->dispatcher;
    }

Usage Example

コード例 #1
0
ファイル: sfView.class.php プロジェクト: bigcalm/urlcatcher
 /**
  * Initializes this view.
  *
  * @param  sfContext $context     The current application context
  * @param  string    $moduleName  The module name for this view
  * @param  string    $actionName  The action name for this view
  * @param  string    $viewName    The view name
  *
  * @return bool  true, if initialization completes successfully, otherwise false
  */
 public function initialize($context, $moduleName, $actionName, $viewName)
 {
     $this->moduleName = $moduleName;
     $this->actionName = $actionName;
     $this->viewName = $viewName;
     $this->context = $context;
     $this->dispatcher = $context->getEventDispatcher();
     sfOutputEscaper::markClassesAsSafe(array('sfForm', 'sfModelGeneratorHelper'));
     $this->attributeHolder = $this->initializeAttributeHolder();
     $this->parameterHolder = new sfParameterHolder();
     $this->parameterHolder->add(sfConfig::get('mod_' . strtolower($moduleName) . '_view_param', array()));
     $request = $context->getRequest();
     $format = $request->getRequestFormat();
     if (null !== $format) {
         if ('html' != $format) {
             $this->setExtension('.' . $format . $this->getExtension());
         }
         if ($mimeType = $request->getMimeType($format)) {
             $this->context->getResponse()->setContentType($mimeType);
             if ('html' != $format) {
                 $this->setDecorator(false);
             }
         }
     }
     $this->dispatcher->notify(new sfEvent($this, 'view.configure_format', array('format' => $format, 'response' => $context->getResponse(), 'request' => $context->getRequest())));
     // include view configuration
     $this->configure();
     return true;
 }
All Usage Examples Of sfContext::getEventDispatcher