本文整理汇总了PHP中sfApplicationConfiguration::getEventDispatcher方法的典型用法代码示例。如果您正苦于以下问题:PHP sfApplicationConfiguration::getEventDispatcher方法的具体用法?PHP sfApplicationConfiguration::getEventDispatcher怎么用?PHP sfApplicationConfiguration::getEventDispatcher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfApplicationConfiguration
的用法示例。
在下文中一共展示了sfApplicationConfiguration::getEventDispatcher方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Initializes this class.
*
* Available options:
*
* * culture: The culture
* * source: The i18n source (XLIFF by default)
* * debug: Whether to enable debug or not (false by default)
* * database: The database name (default by default)
* * untranslated_prefix: The prefix to use when a message is not translated
* * untranslated_suffix: The suffix to use when a message is not translated
*
* @param sfApplicationConfiguration $configuration A sfApplicationConfiguration instance
* @param sfCache $cache A sfCache instance
* @param array $options An array of options
*/
public function initialize(sfApplicationConfiguration $configuration, sfCache $cache = null, $options = array())
{
$this->configuration = $configuration;
$this->dispatcher = $configuration->getEventDispatcher();
$this->cache = $cache;
if (isset($options['culture'])) {
$this->setCulture($options['culture']);
unset($options['culture']);
}
$this->options = array_merge(array('source' => 'XLIFF', 'debug' => false, 'database' => 'default', 'untranslated_prefix' => '[T]', 'untranslated_suffix' => '[/T]'), $options);
$this->dispatcher->connect('user.change_culture', array($this, 'listenToChangeCultureEvent'));
if ($this->isMessageSourceFileBased($this->options['source'])) {
$this->dispatcher->connect('controller.change_action', array($this, 'listenToChangeActionEvent'));
}
}
示例2: initialize
/**
* Initializes the current sfContext instance.
*
* @param sfApplicationConfiguration $configuration An sfApplicationConfiguration instance
*/
public function initialize(sfApplicationConfiguration $configuration)
{
$this->configuration = $configuration;
$this->dispatcher = $configuration->getEventDispatcher();
try {
$this->loadFactories();
} catch (sfException $e) {
$e->printStackTrace();
} catch (Exception $e) {
sfException::createFromException($e)->printStackTrace();
}
$this->dispatcher->connect('template.filter_parameters', array($this, 'filterTemplateParameters'));
// register our shutdown function
register_shutdown_function(array($this, 'shutdown'));
}