Changeset 4951
- Timestamp:
- 09/02/07 18:27:23 (2 years ago)
- Files:
-
- trunk/data/config/core_compile.yml (modified) (1 diff)
- trunk/lib/action/sfAction.class.php (modified) (4 diffs)
- trunk/lib/action/sfActions.class.php (modified) (1 diff)
- trunk/lib/action/sfComponent.class.php (modified) (7 diffs)
- trunk/lib/addon/creole/drivers/sfDebugConnection.php (modified) (13 diffs)
- trunk/lib/addon/propel/generator/sfPropelAdminGenerator.class.php (modified) (1 diff)
- trunk/lib/addon/propel/generator/sfPropelCrudGenerator.class.php (modified) (1 diff)
- trunk/lib/addon/propel/sfMixer.class.php (moved) (moved from trunk/lib/util/sfMixer.class.php)
- trunk/lib/addon/propel/sfPropelAutoload.php (modified) (1 diff)
- trunk/lib/command/sfCommandLogger.class.php (modified) (1 diff)
- trunk/lib/command/sfSymfonyCommandApplication.class.php (modified) (1 diff)
- trunk/lib/config/sfFactoryConfigHandler.class.php (modified) (6 diffs)
- trunk/lib/config/sfViewConfigHandler.class.php (modified) (1 diff)
- trunk/lib/controller/sfController.class.php (modified) (8 diffs)
- trunk/lib/controller/sfFrontWebController.class.php (modified) (1 diff)
- trunk/lib/controller/sfWebController.class.php (modified) (3 diffs)
- trunk/lib/event (added)
- trunk/lib/event/sfEvent.class.php (added)
- trunk/lib/event/sfEventDispatcher.class.php (added)
- trunk/lib/exception/sfException.class.php (modified) (1 diff)
- trunk/lib/filter/sfCacheFilter.class.php (modified) (2 diffs)
- trunk/lib/filter/sfExecutionFilter.class.php (modified) (1 diff)
- trunk/lib/filter/sfFillInFormFilter.class.php (modified) (1 diff)
- trunk/lib/filter/sfFilterChain.class.php (modified) (1 diff)
- trunk/lib/filter/sfRenderingFilter.class.php (modified) (2 diffs)
- trunk/lib/generator/sfGenerator.class.php (modified) (2 diffs)
- trunk/lib/helper/DebugHelper.php (modified) (1 diff)
- trunk/lib/helper/PartialHelper.php (modified) (4 diffs)
- trunk/lib/i18n/sfI18N.class.php (modified) (5 diffs)
- trunk/lib/log/sfLogger.class.php (modified) (2 diffs)
- trunk/lib/log/sfLogger/sfAggregateLogger.class.php (modified) (2 diffs)
- trunk/lib/log/sfLogger/sfFileLogger.class.php (modified) (2 diffs)
- trunk/lib/log/sfLogger/sfNoLogger.class.php (modified) (1 diff)
- trunk/lib/log/sfLogger/sfWebDebugLogger.class.php (modified) (2 diffs)
- trunk/lib/request/sfConsoleRequest.class.php (modified) (1 diff)
- trunk/lib/request/sfRequest.class.php (modified) (5 diffs)
- trunk/lib/request/sfWebRequest.class.php (modified) (7 diffs)
- trunk/lib/response/sfResponse.class.php (modified) (5 diffs)
- trunk/lib/response/sfWebResponse.class.php (modified) (7 diffs)
- trunk/lib/routing/sfPatternRouting.class.php (modified) (5 diffs)
- trunk/lib/routing/sfRouting.class.php (modified) (6 diffs)
- trunk/lib/user/sfBasicSecurityUser.class.php (modified) (6 diffs)
- trunk/lib/user/sfUser.class.php (modified) (8 diffs)
- trunk/lib/util/sfContext.class.php (modified) (3 diffs)
- trunk/lib/validator/sfValidatorManager.class.php (modified) (1 diff)
- trunk/lib/view/sfMailView.class.php (modified) (1 diff)
- trunk/lib/view/sfPHPView.class.php (modified) (2 diffs)
- trunk/lib/view/sfView.class.php (modified) (4 diffs)
- trunk/lib/view/sfViewCacheManager.class.php (modified) (6 diffs)
- trunk/test/unit/action/sfComponentTest.php (modified) (1 diff)
- trunk/test/unit/addon/propel/sfMixerTest.php (moved) (moved from trunk/test/unit/util/sfMixerTest.php)
- trunk/test/unit/controller/sfControllerTest.php (modified) (1 diff)
- trunk/test/unit/controller/sfWebControllerTest.php (modified) (2 diffs)
- trunk/test/unit/event (added)
- trunk/test/unit/event/sfEventDispatcherTest.php (added)
- trunk/test/unit/generator/sfGeneratorTest.php (modified) (2 diffs)
- trunk/test/unit/log/sfAggregateLoggerTest.php (modified) (3 diffs)
- trunk/test/unit/log/sfFileLoggerTest.php (modified) (3 diffs)
- trunk/test/unit/log/sfLoggerTest.php (modified) (2 diffs)
- trunk/test/unit/request/sfRequestTest.php (modified) (6 diffs)
- trunk/test/unit/response/sfResponseTest.php (modified) (3 diffs)
- trunk/test/unit/response/sfWebResponseTest.php (modified) (6 diffs)
- trunk/test/unit/routing/sfNoRoutingTest.php (modified) (1 diff)
- trunk/test/unit/routing/sfPathInfoRoutingTest.php (modified) (1 diff)
- trunk/test/unit/routing/sfPatternRoutingTest.php (modified) (2 diffs)
- trunk/test/unit/sfContextMock.class.php (modified) (3 diffs)
- trunk/test/unit/sfEventDispatcherTest.class.php (added)
- trunk/test/unit/sfMixerTest.class.php (deleted)
- trunk/test/unit/user/sfBasicSecurityUserTest.php (modified) (2 diffs)
- trunk/test/unit/user/sfUserTest.php (modified) (5 diffs)
- trunk/test/unit/view/sfViewTest.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/config/core_compile.yml
r4845 r4951 7 7 - %SF_SYMFONY_LIB_DIR%/controller/sfController.class.php 8 8 - %SF_SYMFONY_LIB_DIR%/database/sfDatabaseManager.class.php 9 - %SF_SYMFONY_LIB_DIR%/event/sfEvent.class.php 10 - %SF_SYMFONY_LIB_DIR%/event/sfEventDispatcher.class.php 9 11 - %SF_SYMFONY_LIB_DIR%/filter/sfFilter.class.php 10 12 - %SF_SYMFONY_LIB_DIR%/filter/sfCommonFilter.class.php trunk/lib/action/sfAction.class.php
r4593 r4951 129 129 if (sfConfig::get('sf_logging_enabled')) 130 130 { 131 $this-> context->getLogger()->info('{sfAction} forward to action "'.$module.'/'.$action.'"');131 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Forward to action "%s/%s"', $module, $action)))); 132 132 } 133 133 … … 191 191 public function redirect($url, $statusCode = 302) 192 192 { 193 $url = $this->getController()->genUrl($url, true);194 195 if (sfConfig::get('sf_logging_enabled'))196 {197 $this->context->getLogger()->info('{sfAction} redirect to "'.$url.'"');198 }199 200 193 $this->getController()->redirect($url, 0, $statusCode); 201 194 … … 412 405 if (sfConfig::get('sf_logging_enabled')) 413 406 { 414 $this-> context->getLogger()->info('{sfAction} change template to "'.$name.'"');407 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Change template to "%s"', $name)))); 415 408 } 416 409 … … 446 439 if (sfConfig::get('sf_logging_enabled')) 447 440 { 448 $this-> context->getLogger()->info('{sfAction} change layout to "'.$name.'"');441 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Change layout to "%s"', $name)))); 449 442 } 450 443 trunk/lib/action/sfActions.class.php
r4597 r4951 45 45 if (sfConfig::get('sf_logging_enabled')) 46 46 { 47 $this-> context->getLogger()->info('{sfAction} call "'.get_class($this).'->'.$actionToRun.'()'.'"');47 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Call "%s->%s()"', get_class($this), $actionToRun)))); 48 48 } 49 49 trunk/lib/action/sfComponent.class.php
r4937 r4951 21 21 protected 22 22 $context = null, 23 $dispatcher = null, 23 24 $request = null, 24 25 $response = null, … … 27 28 28 29 /** 29 * Execute any application/business logic for this component.30 *31 * In a typical database-driven application, execute() handles application32 * logic itself and then proceeds to create a model instance. Once the model33 * instance is initialized it handles all business logic for the action.34 *35 * A model should represent an entity in your application. This could be a36 * user account, a shopping cart, or even a something as simple as a37 * single product.38 *39 * @return mixed A string containing the view name associated with this action40 */41 abstract function execute();42 43 /**44 * Gets the module name associated with this component.45 *46 * @return string A module name47 */48 public function getModuleName()49 {50 return $this->context->getModuleName();51 }52 53 /**54 * Gets the action name associated with this component.55 *56 * @return string An action name57 */58 public function getActionName()59 {60 return $this->context->getActionName();61 }62 63 /**64 30 * Initializes this component. 65 31 * … … 71 37 { 72 38 $this->context = $context; 39 $this->dispatcher = $context->getEventDispatcher(); 73 40 $this->varHolder = new sfParameterHolder(); 74 41 $this->request = $context->getRequest(); … … 80 47 81 48 /** 49 * Execute any application/business logic for this component. 50 * 51 * In a typical database-driven application, execute() handles application 52 * logic itself and then proceeds to create a model instance. Once the model 53 * instance is initialized it handles all business logic for the action. 54 * 55 * A model should represent an entity in your application. This could be a 56 * user account, a shopping cart, or even a something as simple as a 57 * single product. 58 * 59 * @return mixed A string containing the view name associated with this action 60 */ 61 abstract function execute(); 62 63 /** 64 * Gets the module name associated with this component. 65 * 66 * @return string A module name 67 */ 68 public function getModuleName() 69 { 70 return $this->context->getModuleName(); 71 } 72 73 /** 74 * Gets the action name associated with this component. 75 * 76 * @return string An action name 77 */ 78 public function getActionName() 79 { 80 return $this->context->getActionName(); 81 } 82 83 /** 82 84 * Retrieves the current application context. 83 85 * … … 112 114 if (sfConfig::get('sf_logging_enabled')) 113 115 { 114 $this-> context->getLogger()->log($message, constant('sfLogger::'.strtoupper($priority)));116 $this->dispatcher->notify(new sfEvent($this, 'application.log', array($message, 'priority' => constant('sfLogger::'.strtoupper($priority))))); 115 117 } 116 118 } … … 318 320 319 321 /** 320 * Calls methods defined via the sfMixer class.322 * Calls methods defined via sfEventDispatcher. 321 323 * 322 324 * @param string The method name … … 324 326 * 325 327 * @return mixed The returned value of the called method 326 *327 * @see sfMixer328 328 */ 329 329 public function __call($method, $arguments) 330 330 { 331 if (!$callable = sfMixer::getCallable('sfComponent:'.$method)) 331 $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'component.method_not_found', array('method' => $method, 'arguments' => $arguments))); 332 if (!$event->isProcessed()) 332 333 { 333 334 throw new sfException(sprintf('Call to undefined method sfComponent::%s.', $method)); 334 335 } 335 336 336 array_unshift($arguments, $this); 337 338 return call_user_func_array($callable, $arguments); 337 return $event->getReturnValue(); 339 338 } 340 339 } trunk/lib/addon/creole/drivers/sfDebugConnection.php
r4597 r4951 37 37 38 38 /** 39 * Optional PEAR Log class; if set queries will be logged at PEAR_LOG_INFO level.39 * Optional sfEventDispatcher object. 40 40 * @var Log 41 41 */ 42 private static $ logger;43 44 /** 45 * Sets a Logger class (e.g. PEAR Log) to use for logging.46 * The logger class must have a log() method. All messages are logged at default log level.47 * @param object $ logger48 */ 49 public static function set Logger($logger)50 { 51 self::$ logger = $logger;42 private static $dispatcher; 43 44 /** 45 * Sets a sfEventDispatcher object. 46 * 47 * @param object $dispatcher 48 */ 49 public static function setDispatcher($dispatcher) 50 { 51 self::$dispatcher = $dispatcher; 52 52 } 53 53 … … 83 83 $connectionClass = Creole::import($driver); 84 84 $this->childConnection = new $connectionClass(); 85 $this->log(" {sfCreole}connect(): DSN: ". var_export($dsninfo, true) . ", FLAGS: " . var_export($flags, true));85 $this->log("connect(): DSN: ". var_export($dsninfo, true) . ", FLAGS: " . var_export($flags, true)); 86 86 return $this->childConnection->connect($dsninfo, $flags); 87 87 } … … 116 116 public function prepareStatement($sql) 117 117 { 118 $this->log(" {sfCreole}prepareStatement(): $sql");118 $this->log("prepareStatement(): $sql"); 119 119 $obj = $this->childConnection->prepareStatement($sql); 120 120 $objClass = get_class($obj); … … 137 137 public function applyLimit(&$sql, $offset, $limit) 138 138 { 139 $this->log(" {sfCreole}applyLimit(): $sql, offset: $offset, limit: $limit");139 $this->log("applyLimit(): $sql, offset: $offset, limit: $limit"); 140 140 return $this->childConnection->applyLimit($sql, $offset, $limit); 141 141 } … … 146 146 public function close() 147 147 { 148 $this->log(" {sfCreole}close(): Closing connection.");148 $this->log("close(): Closing connection."); 149 149 return $this->childConnection->close(); 150 150 } … … 173 173 } 174 174 175 $this->log(sprintf(" {sfCreole}executeQuery(): [%.2f ms] %s", $elapsedTime * 1000, $sql));175 $this->log(sprintf("executeQuery(): [%.2f ms] %s", $elapsedTime * 1000, $sql)); 176 176 177 177 return $retval; … … 183 183 public function executeUpdate($sql) 184 184 { 185 $this->log(" {sfCreole}executeUpdate(): $sql");185 $this->log("executeUpdate(): $sql"); 186 186 $this->lastExecutedQuery = $sql; 187 187 $this->numQueriesExecuted++; … … 202 202 public function prepareCall($sql) 203 203 { 204 $this->log(" {sfCreole}prepareCall(): $sql");204 $this->log("prepareCall(): $sql"); 205 205 return $this->childConnection->prepareCall($sql); 206 206 } … … 235 235 public function begin() 236 236 { 237 $this->log(" {sfCreole}beginning transaction.");237 $this->log("beginning transaction."); 238 238 return $this->childConnection->begin(); 239 239 } … … 244 244 public function commit() 245 245 { 246 $this->log(" {sfCreole}committing transaction.");246 $this->log("committing transaction."); 247 247 return $this->childConnection->commit(); 248 248 } … … 253 253 public function rollback() 254 254 { 255 $this->log(" {sfCreole}rolling back transaction.");255 $this->log("rolling back transaction."); 256 256 return $this->childConnection->rollback(); 257 257 } … … 262 262 public function setAutoCommit($bit) 263 263 { 264 $this->log(" {sfCreole}setting autocommit to: ".var_export($bit, true));264 $this->log("setting autocommit to: ".var_export($bit, true)); 265 265 return $this->childConnection->setAutoCommit($bit); 266 266 } … … 275 275 276 276 /** 277 * Private function that logs message using specified logger (if provided).277 * Private function that logs message using specified dispatcher (if provided). 278 278 * @param string $msg Message to log. 279 279 */ 280 280 private function log($msg) 281 281 { 282 if (self::$ logger)282 if (self::$dispatcher && sfConfig::get('sf_logging_enabled')) 283 283 { 284 284 // message on one line 285 285 $msg = preg_replace("/\r?\n/", ' ', $msg); 286 self::$ logger->log($msg);286 self::$dispatcher->notify(new sfEvent($this, 'application.log', array($msg))); 287 287 } 288 288 } trunk/lib/addon/propel/generator/sfPropelAdminGenerator.class.php
r3302 r4951 27 27 * @param sfGeneratorManager A sfGeneratorManager instance 28 28 */ 29 public function initialize( $generatorManager)29 public function initialize(sfGeneratorManager $generatorManager) 30 30 { 31 31 parent::initialize($generatorManager); trunk/lib/addon/propel/generator/sfPropelCrudGenerator.class.php
r4597 r4951 27 27 * @param sfGeneratorManager A sfGeneratorManager instance 28 28 */ 29 public function initialize( $generatorManager)29 public function initialize(sfGeneratorManager $generatorManager) 30 30 { 31 31 parent::initialize($generatorManager); trunk/lib/addon/propel/sfPropelAutoload.php
r4845 r4951 25 25 // register our logger 26 26 require_once(sfConfig::get('sf_symfony_lib_dir').'/addon/creole/drivers/sfDebugConnection.php'); 27 sfDebugConnection::set Logger(sfContext::getInstance()->getLogger());27 sfDebugConnection::setDispatcher(sfContext::getInstance()->getEventDispatcher()); 28 28 } 29 29 trunk/lib/command/sfCommandLogger.class.php
r4743 r4951 25 25 * Initializes this logger. 26 26 * 27 * @param array Options for the logger 27 * @param sfEventDispatcher A sfEventDispatcher instance 28 * @param array An array of options. 28 29 */ 29 public function initialize( $options = array())30 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 30 31 { 31 32 if (!isset($options['output'])) trunk/lib/command/sfSymfonyCommandApplication.class.php
r4842 r4951 86 86 { 87 87 $logger = new sfCommandLogger(); 88 $logger->initialize( array('output' => new sfConsoleColorizer()));88 $logger->initialize(new sfEventDispatcher(), array('output' => new sfConsoleColorizer())); 89 89 $this->setLogger($logger); 90 90 } trunk/lib/config/sfFactoryConfigHandler.class.php
r4934 r4951 111 111 112 112 // append instance initialization 113 $inits[] = sprintf(" \$this->factories['request']->initialize(\$this-> factories['logger'], \$this->factories['routing'], sfConfig::get('sf_factory_request_parameters', %s), sfConfig::get('sf_factory_request_attributes', array()));", var_export($parameters, true));113 $inits[] = sprintf(" \$this->factories['request']->initialize(\$this->dispatcher, sfConfig::get('sf_factory_request_parameters', %s), sfConfig::get('sf_factory_request_attributes', array()));", var_export($parameters, true)); 114 114 break; 115 115 … … 119 119 120 120 // append instance initialization 121 $inits[] = sprintf(" \$this->factories['response']->initialize(\$this-> factories['logger'], sfConfig::get('sf_factory_response_parameters', %s));", var_export($parameters, true));121 $inits[] = sprintf(" \$this->factories['response']->initialize(\$this->dispatcher, sfConfig::get('sf_factory_response_parameters', %s));", var_export($parameters, true)); 122 122 $inits[] = sprintf(" if ('HEAD' == \$this->factories['request']->getMethodName())\n { \n \$this->factories['response']->setHeaderOnly(true);\n }\n"); 123 123 break; … … 142 142 143 143 // append instance initialization 144 $inits[] = sprintf(" \$this->factories['user']->initialize(\$this , array_merge(array('use_flash' => sfConfig::get('sf_use_flash')), sfConfig::get('sf_factory_user_parameters', %s)));", var_export(is_array($parameters) ? $parameters : array(), true));144 $inits[] = sprintf(" \$this->factories['user']->initialize(\$this->dispatcher, \$this->factories['storage'], array_merge(array('culture' => \$this->factories['request']->getParameter('sf_culture'), 'default_culture' => sfConfig::get('sf_i18n_default_culture'), 'use_flash' => sfConfig::get('sf_use_flash')), sfConfig::get('sf_factory_user_parameters', %s)));", var_export(is_array($parameters) ? $parameters : array(), true)); 145 145 break; 146 146 … … 186 186 187 187 // append instance initialization 188 $inits[] = sprintf(" \$this->factories['routing']->initialize(\$this-> factories['logger'], array_merge(array('suffix' => sfConfig::get('sf_suffix'), 'default_module' => sfConfig::get('sf_default_module'), 'default_action' => sfConfig::get('sf_default_action')), sfConfig::get('sf_factory_routing_parameters', %s)));", var_export(is_array($parameters) ? $parameters : array(), true));188 $inits[] = sprintf(" \$this->factories['routing']->initialize(\$this->dispatcher, array_merge(array('suffix' => sfConfig::get('sf_suffix'), 'default_module' => sfConfig::get('sf_default_module'), 'default_action' => sfConfig::get('sf_default_action')), sfConfig::get('sf_factory_routing_parameters', %s)));", var_export(is_array($parameters) ? $parameters : array(), true)); 189 189 break; 190 190 … … 217 217 { 218 218 // create logger instance 219 $loggers .= sprintf("\n\$logger = sfLogger::newInstance('%s');\n\$logger->initialize( %s);\n\$this->factories['logger']->addLogger(\$logger);\n",219 $loggers .= sprintf("\n\$logger = sfLogger::newInstance('%s');\n\$logger->initialize(\$this->dispatcher, %s);\n\$this->factories['logger']->addLogger(\$logger);\n", 220 220 $keys['class'], 221 221 isset($keys['param']) ? var_export($keys['param'], true) : '' … … 229 229 $instances[] = sprintf( 230 230 " \$this->factories['logger'] = sfLogger::newInstance(sfConfig::get('sf_factory_logger', '%s'));\n". 231 " \$this->factories['logger']->initialize( sfConfig::get('sf_factory_logger_parameters', %s));\n".231 " \$this->factories['logger']->initialize(\$this->dispatcher, sfConfig::get('sf_factory_logger_parameters', %s));\n". 232 232 " %s" 233 233 , $class, var_export($parameters, true), $loggers); trunk/lib/config/sfViewConfigHandler.class.php
r4593 r4951 155 155 156 156 $data .= " \$this->setComponentSlot('$name', '{$component[0]}', '{$component[1]}');\n"; 157 $data .= " if (sfConfig::get('sf_logging_enabled')) \$this->context->get Logger()->info('{sfViewConfig} set component \"$name\" ({$component[0]}/{$component[1]})');\n";157 $data .= " if (sfConfig::get('sf_logging_enabled')) \$this->context->getEventDispatcher()->notify(new sfEvent(\$this, 'application.log', array(sprintf('Set component \"%s\" (%s/%s)', $name, $component[0], $component[1]))));\n"; 158 158 } 159 159 trunk/lib/controller/sfController.class.php
r4937 r4951 23 23 protected 24 24 $context = null, 25 $dispatcher = null, 25 26 $controllerClasses = array(), 26 27 $maxForwards = 5, … … 172 173 if (sfConfig::get('sf_logging_enabled')) 173 174 { 174 $this-> context->getLogger()->info('{sfController} action does not exist');175 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Action does not exist'))); 175 176 } 176 177 … … 224 225 require(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_module_dir_name').'/'.$moduleName.'/'.sfConfig::get('sf_app_module_config_dir_name').'/filters.yml')); 225 226 226 if ($moduleName == sfConfig::get('sf_error_404_module') && $actionName == sfConfig::get('sf_error_404_action')) 227 { 228 $this->context->getResponse()->setStatusCode(404); 229 $this->context->getResponse()->setHttpHeader('Status', '404 Not Found'); 230 231 foreach (sfMixer::getCallables('sfController:forward:error404') as $callable) 232 { 233 call_user_func($callable, $this, $moduleName, $actionName); 234 } 235 } 236 237 // change i18n message source directory to our module 238 if (sfConfig::get('sf_i18n')) 239 { 240 $this->context->getI18N()->setMessageSource(sfLoader::getI18NDirs($moduleName), $this->context->getUser()->getCulture()); 241 } 227 $this->context->getEventDispatcher()->notify(new sfEvent($this, 'controller.change_action', array('module' => $moduleName, 'action' => $actionName))); 242 228 243 229 // process the filter chain … … 335 321 336 322 /** 337 * Retrieves the current application context.338 *339 * @return sfContext A sfContext instance340 */341 public function getContext()342 {343 return $this->context;344 }345 346 /**347 323 * Retrieves the presentation rendering mode. 348 324 * … … 401 377 public function initialize($context) 402 378 { 403 $this->context = $context; 379 $this->context = $context; 380 $this->dispatcher = $context->getEventDispatcher(); 404 381 405 382 if (sfConfig::get('sf_logging_enabled')) 406 383 { 407 $this-> context->getLogger()->info('{sfController} initialization');384 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Initialization'))); 408 385 } 409 386 … … 470 447 if (sfConfig::get('sf_logging_enabled')) 471 448 { 472 $this-> context->getLogger()->info('{sfController} get presentation for action "'.$module.'/'.$action.'" (view class: "'.$viewName.'")');449 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Get presentation for action "%s/%s" (view class: "%s")', $module, $action, $viewName)))); 473 450 } 474 451 … … 559 536 560 537 /** 561 * Calls methods defined via the sfMixer class.538 * Calls methods defined via sfEventDispatcher. 562 539 * 563 540 * @param string The method name … … 565 542 * 566 543 * @return mixed The returned value of the called method 567 *568 * @see sfMixer569 544 */ 570 545 public function __call($method, $arguments) 571 546 { 572 if (!$callable = sfMixer::getCallable('sfController:'.$method)) 547 $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'controller.method_not_found', array('method' => $method, 'arguments' => $arguments))); 548 if (!$event->isProcessed()) 573 549 { 574 550 throw new sfException(sprintf('Call to undefined method sfController::%s.', $method)); 575 551 } 576 552 577 array_unshift($arguments, $this); 578 579 return call_user_func_array($callable, $arguments); 553 return $event->getReturnValue(); 580 554 } 581 555 } trunk/lib/controller/sfFrontWebController.class.php
r4839 r4951 34 34 if (sfConfig::get('sf_logging_enabled')) 35 35 { 36 $this-> context->getLogger()->info('{sfController} dispatch request');36 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Dispatch request'))); 37 37 } 38 38 trunk/lib/controller/sfWebController.class.php
r4762 r4951 94 94 } 95 95 96 $r = $this->context->getRouting(); 97 if ($r->hasRoutes() && $generated_url = $r->generate($route_name, $parameters, $querydiv, $divider, $equals)) 98 { 99 $url .= $generated_url; 100 } 101 else 102 { 103 $query = http_build_query($parameters); 104 105 if (sfConfig::get('sf_url_format') == 'PATH') 106 { 107 $query = strtr($query, ini_get('arg_separator.output').'=', '/'); 108 } 109 110 $url .= $query; 111 } 96 // routing to generate path 97 $url .= $this->context->getRouting()->generate($route_name, $parameters, $querydiv, $divider, $equals); 112 98 113 99 if ($absolute) … … 211 197 public function redirect($url, $delay = 0, $statusCode = 302) 212 198 { 199 $url = $this->genUrl($url, true); 200 213 201 $response = $this->context->getResponse(); 214 202 … … 219 207 $response->setContent(sprintf('<html><head><meta http-equiv="refresh" content="%d;url=%s"/></head></html>', $delay, htmlentities($url, ENT_QUOTES, sfConfig::get('sf_charset')))); 220 208 209 if (sfConfig::get('sf_logging_enabled')) 210 { 211 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Redirect to "%s"', $url)))); 212 } 213 221 214 if (!sfConfig::get('sf_test')) 222 215 { trunk/lib/exception/sfException.class.php
r4938 r4951 61 61 } 62 62 63 if (class_exists('sfMixer', false)) 64 { 65 foreach (sfMixer::getCallables('sfException:printStackTrace:printStackTrace') as $callable) 66 { 67 $ret = call_user_func($callable, $this, $exception); 68 if ($ret) 63 if (sfContext::hasInstance()) 64 { 65 $dispatcher = sfContext::getInstance()->getEventDispatcher(); 66 67 if (sfConfig::get('sf_logging_enabled')) 68 { 69 $dispatcher->notify(new sfEvent($this, 'application.log', array($exception->getMessage(), 'priority' => sfLogger::ERR))); 70 } 71 72 $event = $dispatcher->notifyUntil(new sfEvent($this, 'application.throw_exception', array('exception' => $exception))); 73 if ($event->isProcessed()) 74 { 75 if (!sfConfig::get('sf_test')) 69 76 { 70 if (!sfConfig::get('sf_test')) 71 { 72 exit(1); 73 } 74 75 return; 77 exit(1); 76 78 } 77 } 78 } 79 80 if (sfConfig::get('sf_logging_enabled') && sfContext::hasInstance()) 81 { 82 sfContext::getInstance()->getLogger()->err(sprintf('{%s} %s', __CLASS__, $exception->getMessage())); 79 80 return; 81 } 83 82 } 84 83 trunk/lib/filter/sfCacheFilter.class.php
r4603 r4951 148 148 if (sfConfig::get('sf_logging_enabled')) 149 149 { 150 $this->context->get Logger()->info('{sfFilter} ETag matches If-None-Match (send 304)');150 $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array('ETag matches If-None-Match (send 304)'))); 151 151 } 152 152 } … … 166 166 if (sfConfig::get('sf_logging_enabled')) 167 167 { 168 $this->context->get Logger()->info('{sfFilter} Last-Modified matches If-Modified-Since (send 304)');168 $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array('Last-Modified matches If-Modified-Since (send 304)'))); 169 169 } 170 170 } trunk/lib/filter/sfExecutionFilter.class.php
r4606 r4951 140 140 } 141 141 142 if ( !$validated &&sfConfig::get('sf_logging_enabled'))143 { 144 $this->context->get Logger()->info('{sfFilter} action validation failed');142 if (sfConfig::get('sf_logging_enabled')) 143 { 144 $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array('Action validation failed'))); 145 145 } 146 146 trunk/lib/filter/sfFillInFormFilter.class.php
r4593 r4951 60 60 if (sfConfig::get('sf_logging_enabled')) 61 61 { 62 $this->context->get Logger()->err(sprintf('{sfFilter} %s', $e->getMessage()));62 $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array($e->getMessage(), 'priority' => sfLogger::ERR))); 63 63 } 64 64 } trunk/lib/filter/sfFilterChain.class.php
r3244 r4951 37 37 if (sfConfig::get('sf_logging_enabled')) 38 38 { 39 sfContext::getInstance()->get Logger()->info(sprintf('{sfFilter} executing filter "%s"', get_class($this->chain[$this->index])));39 sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array(sprintf('Executing filter "%s"', get_class($this->chain[$this->index]))))); 40 40 } 41 41 trunk/lib/filter/sfRenderingFilter.class.php
r4593 r4951 35 35 if (sfConfig::get('sf_logging_enabled')) 36 36 { 37 $this->context->get Logger()->info('{sfFilter} render to client');37 $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array('Render to the client'))); 38 38 } 39 39 … … 50 50 if (sfConfig::get('sf_debug') && sfConfig::get('sf_logging_enabled')) 51 51 { 52 $ logger = $this->context->getLogger();52 $messages = array(); 53 53 foreach (sfTimerManager::getTimers() as $name => $timer) 54 54 { 55 $ logger->info(sprintf('{sfTimerManager} %s %.2f ms (%d)', $name, $timer->getElapsedTime() * 1000, $timer->getCalls()));55 $messages[] = sprintf('%s %.2f ms (%d)', $name, $timer->getElapsedTime() * 1000, $timer->getCalls()); 56 56 } 57 58 $this->context->getEventDispatcher()->notify(new sfEvent($this, 'application.log', $messages)); 57 59 } 58 60 } trunk/lib/generator/sfGenerator.class.php
r4597 r4951 31 31 * @param sfGeneratorManager A sfGeneratorManager instance 32 32 */ 33 public function initialize( $generatorManager)33 public function initialize(sfGeneratorManager $generatorManager) 34 34 { 35 35 $this->generatorManager = $generatorManager; … … 210 210 $this->theme = $theme; 211 211 } 212 213 /**214 * Calls methods defined via the sfMixer class.215 *216 * @param string The method name217 * @param array The method arguments218 *219 * @return mixed The returned value of the called method220 *221 * @see sfMixer222 */223 public function __call($method, $arguments)224 {225 if (!$callable = sfMixer::getCallable('sfGenerator:'.$method))226 {227 throw new sfException(sprintf('Call to undefined method sfGenerator::%s.', $method));228 }229 230 array_unshift($arguments, $this);231 232 return call_user_func_array($callable, $arguments);233 }234 212 } trunk/lib/helper/DebugHelper.php
r4850 r4951 13 13 if (sfConfig::get('sf_logging_enabled')) 14 14 { 15 sfContext::getInstance()->get Logger()->log($message, constant('sfLogger::'.strtoupper($priority)));15 sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent(null, 'application.log', array($message, 'priority' => constant('sfLogger::'.strtoupper($priority))))); 16 16 } 17 17 } trunk/lib/helper/PartialHelper.php
r4885 r4951 159 159 if (sfConfig::get('sf_logging_enabled')) 160 160 { 161 $context->get Logger()->info('{PartialHelper} call "'.$moduleName.'->'.$componentToRun.'()'.'"');161 $context->getEventDispatcher()->notify(new sfEvent(null, 'application.log', array(sprintf('Call "%s->%s()'.'"', $moduleName, $componentToRun)))); 162 162 } 163 163 … … 323 323 if (sfConfig::get('sf_logging_enabled')) 324 324 { 325 $context->get Logger()->info(sprintf('{PartialHelper} set slot "%s"', $name));325 $context->getEventDispatcher()->notify(new sfEvent(null, 'application.log', array(sprintf('Set slot "%s"', $name)))); 326 326 } 327 327 … … 389 389 if (sfConfig::get('sf_logging_enabled')) 390 390 { 391 $context->get Logger()->info(sprintf('{PartialHelper} get slot "%s"', $name));391 $context->getEventDispatcher()->notify(new sfEvent(null, 'application.log', array(sprintf('Get slot "%s"', $name)))); 392 392 } 393 393 … … 423 423 if (sfConfig::get('sf_logging_enabled')) 424 424 { 425 $context->get Logger()->info(sprintf('{PartialHelper} get slot "%s"', $name));425 $context->getEventDispatcher()->notify(new sfEvent(null, 'application.log', array(sprintf('Get slot "%s"', $name)))); 426 426 } 427 427 trunk/lib/i18n/sfI18N.class.php
r4590 r4951 37 37 38 38 include(sfConfigCache::getInstance()->checkConfig(sfConfig::get('sf_app_config_dir_name').'/i18n.yml')); 39 40 $context->getEventDispatcher()->connect('user.change_culture', array($this, 'listenToChangeCultureEvent')); 41 $context->getEventDispatcher()->connect('controller.change_action', array($this, 'listenToChangeActionEvent')); 39 42 } 40 43 … … 45 48 * @param string The culture 46 49 */ 47 public function setMessageSource($dirs, $culture )50 public function setMessageSource($dirs, $culture = null) 48 51 { 49 52 if (is_null($dirs)) … … 61 64 } 62 65 63 $this->setCulture($culture); 66 if (!is_null($culture)) 67 { 68 $this->setCulture($culture); 69 } 70 else 71 { 72 $this->messageSource->setCulture($this->culture); 73 } 74 64 75 $this->messageFormat = null; 65 76 } … … 91 102 public function setCulture($culture) 92 103 { 104 $this->culture = $culture; 105 93 106 if ($this->messageSource) 94 107 { 95 $this->culture = $culture;96 108 $this->messageSource->setCulture($culture); 97 109 } … … 234 246 } 235 247 } 248 249 /** 250 * Listens to the user.change_culture event. 251 * 252 * @param sfEvent An sfEvent instance 253 * 254 */ 255 public function listenToChangeCultureEvent(sfEvent $event) 256 { 257 // change the message format object with the new culture 258 $this->setCulture($event->getParameter('culture')); 259 } 260 261 /** 262 * Listens to the controller.change_action event. 263 * 264 * @param sfEvent An sfEvent instance 265 * 266 */ 267 public function listenToChangeActionEvent(sfEvent $event) 268 { 269 // change message source directory to our module 270 $this->setMessageSource(sfLoader::getI18NDirs($event->getParameter('module'))); 271 } 236 272 } trunk/lib/log/sfLogger.class.php
r4847 r4951 70 70 * Initializes this sfLogger instance. 71 71 * 72 * @param array An associative array of initialization parameters.73 *74 72 * Available options: 75 73 * 76 74 * - level: The log level. 77 75 * 78 * @return bool true, if initialization completes successfully, otherwise false. 79 * 80 * @throws <b>sfInitializationException</b> If an error occurs while initializing this User. 81 */ 82 public function initialize($parameters = array()) 83 { 84 if (isset($parameters['level'])) 85 { 86 $this->setLogLevel($parameters['level']); 87 } 76 * @param sfEventDispatcher A sfEventDispatcher instance 77 * @param array An array of options. 78 * 79 * @return Boolean true, if initialization completes successfully, otherwise false. 80 * 81 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfLogger. 82 */ 83 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 84 { 85 if (isset($options['level'])) 86 { 87 $this->setLogLevel($options['level']); 88 } 89 90 $dispatcher->connect('application.log', array($this, 'listenToLogEvent')); 88 91 } 89 92 … … 215 218 { 216 219 $this->log($message, self::DEBUG); 220 } 221 222 /** 223 * Listens to application.log events. 224 * 225 * @param sfEvent An sfEvent instance 226 * 227 */ 228 public function listenToLogEvent(sfEvent $event) 229 { 230 $priority = $event->getParameterHolder()->remove('priority'); 231 if (!$priority) 232 { 233 $priority = self::INFO; 234 } 235 $subject = $event->getSubject(); 236 $subject = is_object($subject) ? get_class($subject) : (is_string($subject) ? $subject : 'main'); 237 foreach ($event->getParameterHolder()->getAll() as $message) 238 { 239 $this->log(sprintf('{%s} %s', $subject, $message), $priority); 240 } 217 241 } 218 242 trunk/lib/log/sfLogger/sfAggregateLogger.class.php
r4845 r4951 29 29 * - loggers: Logger objects that extends sfLogger. 30 30 * 31 * @param array Options for the logger 31 * @param sfEventDispatcher A sfEventDispatcher instance 32 * @param array An array of options. 33 * 34 * @return Boolean true, if initialization completes successfully, otherwise false. 32 35 */ 33 public function initialize( $options = array())36 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 34 37 { 35 38 if (isset($options['loggers'])) … … 43 46 } 44 47 45 return parent::initialize($ options);48 return parent::initialize($dispatcher, $options); 46 49 } 47 50 trunk/lib/log/sfLogger/sfFileLogger.class.php
r4845 r4951 30 30 * You can use any support php wrapper. To write logs to the Apache error log, use php://stderr 31 31 * 32 * @param array Options for the logger 32 * @param sfEventDispatcher A sfEventDispatcher instance 33 * @param array An array of options. 34 * 35 * @return Boolean true, if initialization completes successfully, otherwise false. 33 36 */ 34 public function initialize( $options = array())37 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 35 38 { 36 39 if (!isset($options['file'])) … … 52 55 $this->fp = fopen($options['file'], 'a'); 53 56 54 return parent::initialize($ options);57 return parent::initialize($dispatcher, $options); 55 58 } 56 59 trunk/lib/log/sfLogger/sfNoLogger.class.php
r4845 r4951 20 20 { 21 21 /** 22 * Initializes this logger. 23 * 24 * @param sfEventDispatcher A sfEventDispatcher instance 25 * @param array An array of options. 26 * 27 * @return Boolean true, if initialization completes successfully, otherwise false. 28 */ 29 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 30 { 31 } 32 33 /** 22 34 * Logs a message. 23 35 * trunk/lib/log/sfLogger/sfWebDebugLogger.class.php
r4850 r4951 27 27 * Initializes this logger. 28 28 * 29 * @param array Logger options 29 * @param sfEventDispatcher A sfEventDispatcher instance 30 * @param array An array of options. 31 * 32 * @return Boolean true, if initialization completes successfully, otherwise false. 30 33 */ 31 public function initialize( $options = array())34 public function initialize(sfEventDispatcher $dispatcher, $options = array()) 32 35 { 33 36 if (!sfConfig::get('sf_web_debug')) … … 39 42 $this->context = sfContext::getInstance(); 40 43 41 return parent::initialize($ options);44 return parent::initialize($dispatcher, $options); 42 45 } 43 46 trunk/lib/request/sfConsoleRequest.class.php
r4895 r4951 23 23 * Initializes this sfRequest. 24 24 * 25 * @param sfLogger A sfLogger instance (can be null) 26 * @param sfRouting A sfRouting instance (can be null) 27 * @param array An associative array of initialization parameters 28 * @param array An associative array of initialization attributes 25 * @param sfEventDispatcher A sfEventDispatcher instance 26 * @param array An associative array of initialization parameters 27 * @param array An associative array of initialization attributes 29 28 * 30 * @return Boolean true, if initialization completes successfully, otherwise false29 * @return Boolean true, if initialization completes successfully, otherwise false 31 30 * 32 * @throws <b>sfInitializationException</b> If an error occurs while initializing this Request31 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRequest 33 32 */ 34 public function initialize(sf Logger $logger = null, sfRouting $routing = null, $parameters = array(), $attributes = array())33 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array()) 35 34 { 36 parent::initialize($ logger, $routing, $parameters, $attributes);35 parent::initialize($dispatcher, $parameters, $attributes); 37 36 38 37 $this->getParameterHolder()->add($_SERVER['argv']); trunk/lib/request/sfRequest.class.php
r4895 r4951 61 61 protected 62 62 $errors = array(), 63 $logger = null, 64 $routing = null, 63 $dispatcher = null, 65 64 $method = null, 66 65 $parameterHolder = null, … … 71 70 * Initializes this sfRequest. 72 71 * 73 * @param sfLogger A sfLogger instance (can be null) 74 * @param sfRouting A sfRouting instance (can be null) 75 * @param array An associative array of initialization parameters 76 * @param array An associative array of initialization attributes 77 * 78 * @return Boolean true, if initialization completes successfully, otherwise false 79 * 80 * @throws <b>sfInitializationException</b> If an error occurs while initializing this Request 81 */ 82 public function initialize(sfLogger $logger = null, sfRouting $routing = null, $parameters = array(), $attributes = array()) 83 { 84 $this->logger = $logger; 85 $this->routing = $routing; 72 * @param sfEventDispatcher A sfEventDispatcher instance 73 * @param array An associative array of initialization parameters 74 * @param array An associative array of initialization attributes 75 * 76 * @return Boolean true, if initialization completes successfully, otherwise false 77 * 78 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRequest 79 */ 80 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array()) 81 { 82 $this->dispatcher = $dispatcher; 86 83 87 84 // initialize parameter and attribute holders … … 235 232 public function setError($name, $message) 236 233 { 237 if ( !is_null($this->logger))238 { 239 $this-> logger->info('{sfRequest} error in form for parameter "'.$name.'" (with message "'.$message.'")');234 if (sfConfig::get('sf_logging_enabled')) 235 { 236 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Error in form for parameter "%s" (with message "%s")', $name, $message)))); 240 237 } 241 238 … … 386 383 387 384 /** 388 * Overloads a given method.389 * 390 * @param string Method name391 * @param string Method arguments392 * 393 * @return mixed User function callback385 * Calls methods defined via sfEventDispatcher. 386 * 387 * @param string The method name 388 * @param array The method arguments 389 * 390 * @return mixed The returned value of the called method 394 391 * 395 392 * @throws <b>sfException</b> if call fails … … 397 394 public function __call($method, $arguments) 398 395 { 399 if (!$callable = sfMixer::getCallable('sfRequest:'.$method)) 396 $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'request.method_not_found', array('method' => $method, 'arguments' => $arguments))); 397 if (!$event->isProcessed()) 400 398 { 401 399 throw new sfException(sprintf('Call to undefined method sfRequest::%s.', $method)); 402 400 } 403 401 404 array_unshift($arguments, $this); 405 406 return call_user_func_array($callable, $arguments); 402 return $event->getReturnValue(); 407 403 } 408 404 } trunk/lib/request/sfWebRequest.class.php
r4895 r4951 14 14 * 15 15 * This class manages web requests. It parses input from the request and store them as parameters. 16 * sfWebRequest is able to parse request with routing support enabled.17 16 * 18 17 * @package symfony … … 32 31 $getParameters = null, 33 32 $postParameters = null, 34 $r outingParameters = null;33 $requestParameters = null; 35 34 36 35 /** 37 36 * Initializes this sfRequest. 38 37 * 39 * @param sfLogger A sfLogger instance (can be null) 40 * @param sfRouting A sfRouting instance (can be null) 41 * @param array An associative array of initialization parameters 42 * @param array An associative array of initialization attributes 43 * 44 * @return Boolean true, if initialization completes successfully, otherwise false 45 * 46 * @throws <b>sfInitializationException</b> If an error occurs while initializing this Request 47 */ 48 public function initialize(sfLogger $logger = null, sfRouting $routing = null, $parameters = array(), $attributes = array()) 49 { 50 parent::initialize($logger, $routing, $parameters, $attributes); 38 * @param sfEventDispatcher A sfEventDispatcher instance 39 * @param array An associative array of initialization parameters 40 * @param array An associative array of initialization attributes 41 * 42 * @return Boolean true, if initialization completes successfully, otherwise false 43 * 44 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRequest 45 */ 46 public function initialize(sfEventDispatcher $dispatcher, $parameters = array(), $attributes = array()) 47 { 48 parent::initialize($dispatcher, $parameters, $attributes); 51 49 52 50 if (isset($_SERVER['REQUEST_METHOD'])) … … 431 429 } 432 430 433 public function getR outingParameters()434 { 435 return $this->r outingParameters;431 public function getRequestParameters() 432 { 433 return $this->requestParameters; 436 434 } 437 435 … … 780 778 } 781 779 782 protected function parseRoutingParameters() 783 { 784 if (is_null($this->routing)) 785 { 786 return; 787 } 788 789 $parameters = $this->routing->parse($this->getPathInfo()); 790 if (!is_null($parameters)) 791 { 792 if (!isset($parameters['module'])) 793 { 794 $parameters['module'] = sfConfig::get('sf_default_module', 'default'); 795 } 796 797 if (!isset($parameters['action'])) 798 { 799 $parameters['action'] = sfConfig::get('sf_default_action', 'index'); 800 } 801 } 802 else 780 protected function parseRequestParameters() 781 { 782 $parameters = array(); 783 784 try 785 { 786 $parameters = $this->dispatcher->filter(new sfEvent($this, 'request.load_parameters', array('path_info' => $this->getPathInfo())), $parameters)->getReturnValue(); 787 } 788 catch (sfError404Exception $e) 803 789 { 804 790 $parameters['module'] = sfConfig::get('sf_error_404_module', 'default'); … … 806 792 } 807 793 808 $this->routingParameters = $parameters; 794 if (!isset($parameters['module'])) 795 { 796 $parameters['module'] = sfConfig::get('sf_default_module', 'default'); 797 } 798 799 if (!isset($parameters['action'])) 800 { 801 $parameters['action'] = sfConfig::get('sf_default_action', 'index'); 802 } 803 804 $this->requestParameters = $parameters; 809 805 } 810 806 … … 819 815 $this->parameterHolder->add($this->getParameters); 820 816 821 // routingparameters822 $this->parseR outingParameters();823 $this->parameterHolder->add($this->r outingParameters);817 // additional parameters 818 $this->parseRequestParameters(); 819 $this->parameterHolder->add($this->requestParameters); 824 820 825 821 // POST parameters … … 837 833 } 838 834 839 if ( !is_null($this->logger))840 { 841 $this-> logger->info(sprintf('{sfRequest} request parameters %s', str_replace("\n", '', var_export($this->getParameterHolder()->getAll(), true))));835 if (sfConfig::get('sf_logging_enabled')) 836 { 837 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Request parameters %s', str_replace("\n", '', var_export($this->getParameterHolder()->getAll(), true)))))); 842 838 } 843 839 } trunk/lib/response/sfResponse.class.php
r4895 r4951 22 22 protected 23 23 $parameterHolder = null, 24 $ logger= null,24 $dispatcher = null, 25 25 $content = ''; 26 26 … … 28 28 * Initializes this sfResponse. 29 29 * 30 * @param sfLogger A sfLogger instance (can be null) 30 * @param sfEventDispatcher A sfEventDispatcher instance 31 * @param array An array of parameters 31 32 * 32 * @return Boolean true, if initialization completes successfully, otherwise false33 * @return Boolean true, if initialization completes successfully, otherwise false 33 34 * 34 * @throws <b>sfInitializationException</b> If an error occurs while initializing this Response35 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfResponse 35 36 */ 36 public function initialize(sf Logger $logger = null, $parameters = array())37 public function initialize(sfEventDispatcher $dispatcher, $parameters = array()) 37 38 { 38 $this-> logger = $logger;39 $this->dispatcher = $dispatcher; 39 40 40 41 $this->parameterHolder = new sfParameterHolder(); … … 88 89 public function sendContent() 89 90 { 90 if ( !is_null($this->logger))91 if (sfConfig::get('sf_logging_enabled')) 91 92 { 92 $this-> logger->info('{sfResponse} send content ('.strlen($this->getContent()).' o)');93 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send content (%s o)', strlen($this->getContent()))))); 93 94 } 94 95 … … 146 147 147 148 /** 148 * Overloads a given method.149 * Calls methods defined via sfEventDispatcher. 149 150 * 150 * @param string Method name151 * @param string Method arguments151 * @param string The method name 152 * @param array The method arguments 152 153 * 153 * @return mixed User function callback154 * @return mixed The returned value of the called method 154 155 * 155 156 * @throws <b>sfException</b> If the calls fails … … 157 158 public function __call($method, $arguments) 158 159 { 159 if (!$callable = sfMixer::getCallable('sfResponse:'.$method)) 160 $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'response.method_not_found', array('method' => $method, 'arguments' => $arguments))); 161 if (!$event->isProcessed()) 160 162 { 161 163 throw new sfException(sprintf('Call to undefined method sfResponse::%s.', $method)); 162 164 } 163 165 164 array_unshift($arguments, $this); 165 166 return call_user_func_array($callable, $arguments); 166 return $event->getReturnValue(); 167 167 } 168 168 } trunk/lib/response/sfWebResponse.class.php
r4895 r4951 31 31 * Initializes this sfWebResponse. 32 32 * 33 * @param sfLogger A sfLogger instance (can be null) 34 * 35 * @return Boolean true, if initialization completes successfully, otherwise false 36 * 37 * @throws <b>sfInitializationException</b> If an error occurs while initializing this Response 38 */ 39 public function initialize(sfLogger $logger = null, $parameters = array()) 40 { 41 parent::initialize($logger, $parameters); 33 * @param sfEventDispatcher A sfEventDispatcher instance 34 * @param array An array of parameters 35 * 36 * @return Boolean true, if initialization completes successfully, otherwise false 37 * 38 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfResponse 39 */ 40 public function initialize(sfEventDispatcher $dispatcher, $parameters = array()) 41 { 42 parent::initialize($dispatcher, $parameters); 43 44 $this->dispatcher->connect('controller.change_action', array($this, 'listenToChangeActionEvent')); 42 45 43 46 $this->statusTexts = array( … … 266 269 header($status); 267 270 268 if ( !is_null($this->logger))269 { 270 $this-> logger->info('{sfResponse} send status "'.$status.'"');271 if (sfConfig::get('sf_logging_enabled')) 272 { 273 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send status "%s"', $status)))); 271 274 } 272 275 … … 276 279 header($name.': '.$value); 277 280 278 if ( !is_null($this->logger) && $value != '')279 { 280 $this-> logger->info('{sfResponse} send header "'.$name.'": "'.$value.'"');281 if ($value != '' && sfConfig::get('sf_logging_enabled')) 282 { 283 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send header "%s": "%s"', $name, $value)))); 281 284 } 282 285 } … … 294 297 } 295 298 296 if ( !is_null($this->logger))297 { 298 $this-> logger->info('{sfResponse} send cookie "'.$cookie['name'].'": "'.$cookie['value'].'"');299 if (sfConfig::get('sf_logging_enabled')) 300 { 301 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Send cookie "%s": "%s"', $cookie['name'], $cookie['value'])))); 299 302 } 300 303 } … … 311 314 parent::sendContent(); 312 315 } 316 } 317 318 /** 319 * Sends the HTTP headers and the content. 320 */ 321 final public function send() 322 { 323 $this->sendHttpHeaders(); 324 $this->sendContent(); 313 325 } 314 326 … … 623 635 $data = unserialize($serialized); 624 636 625 $this->initialize( );637 $this->initialize(sfContext::hasInstance() ? sfContext::getInstance()->getEventDispatcher() : new sfEventDispatcher()); 626 638 627 639 $this->content = $data[0]; … … 632 644 $this->headerOnly = $data[5]; 633 645 } 646 647 /** 648 * Listens to the controller.change_action event. 649 * 650 * @param sfEvent An sfEvent instance 651 * 652 */ 653 public function listenToChangeActionEvent(sfEvent $event) 654 { 655 $moduleName = $event->getParameter('module'); 656 $actionName = $event->getParameter('action'); 657 658 if ($moduleName == sfConfig::get('sf_error_404_module') && $actionName == sfConfig::get('sf_error_404_action')) 659 { 660 $this->setStatusCode(404); 661 $this->setHttpHeader('Status', '404 Not Found'); 662 663 $this->dispatcher->notify(new sfEvent($this, 'controller.page_not_found', array('module' => $moduleName, 'action' => $actionName))); 664 } 665 } 634 666 } trunk/lib/routing/sfPatternRouting.class.php
r4899 r4951 33 33 * Initialize this Routing. 34 34 * 35 * @param sfLogger A sfLogger instance (or null)36 * @param arrayAn associative array of initialization parameters.37 * 38 * @return booltrue, if initialization completes successfully, otherwise false.39 * 40 * @throws <b>sfInitializationException</b> If an error occurs while initializing this User.41 */ 42 public function initialize(sf Logger $logger = null, $parameters = array())43 { 44 parent::initialize($ logger, $parameters);35 * @param sfEventDispatcher A sfEventDispatcher instance 36 * @param array An associative array of initialization parameters. 37 * 38 * @return Boolean true, if initialization completes successfully, otherwise false. 39 * 40 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRouting. 41 */ 42 public function initialize(sfEventDispatcher $dispatcher, $parameters = array()) 43 { 44 parent::initialize($dispatcher, $parameters); 45 45 46 46 $this->setDefaultSuffix($this->parameterHolder->get('suffix')); … … 166 166 public function clearRoutes() 167 167 { 168 if ( !is_null($this->logger))169 { 170 $this-> logger->info('{sfRouting} clear all current routes');168 if (sfConfig::get('sf_logging_enabled')) 169 { 170 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Clear all current routes'))); 171 171 } 172 172 … … 327 327 } 328 328 329 if ( !is_null($this->logger))330 { 331 $this-> logger->info(sprintf('{sfRouting} connect "%s"%s', $route, $suffix ? ' ("'.$suffix.'" suffix)' : ''));329 if (sfConfig::get('sf_logging_enabled')) 330 { 331 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Connect "%s"%s', $route, $suffix ? ' ("'.$suffix.'" suffix)' : '')))); 332 332 } 333 333 … … 575 575 $this->currentInternalUri = null; 576 576 577 if ( !is_null($this->logger))578 { 579 $this-> logger->info(sprintf('{sfRouting} match route [%s] "%s"', $routeName, $route));577 if (sfConfig::get('sf_logging_enabled')) 578 { 579 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Match route [%s] "%s"', $routeName, $route)))); 580 580 } 581 581 … … 584 584 } 585 585 } 586 587 $this->currentRouteParameters = $out;588 586 589 587 // no route found 590 588 if (!$break) 591 589 { 592 if ( !is_null($this->logger))593 { 594 $this-> logger->info('{sfRouting} no matching route found');590 if (sfConfig::get('sf_logging_enabled')) 591 { 592 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('No matching route found'))); 595 593 } 596 594 597 595 $this->currentRouteParameters = null; 598 } 596 597 throw new sfError404Exception('No matching route found'); 598 } 599 600 $this->currentRouteParameters = $out; 599 601 600 602 return $this->currentRouteParameters; trunk/lib/routing/sfRouting.class.php
r4892 r4951 20 20 { 21 21 protected 22 $ logger= null,22 $dispatcher = null, 23 23 $defaultParameters = array(), 24 24 $parameterHolder = null; … … 31 31 * @return sfRouting A sfRouting implementation instance. 32 32 * 33 * @throws <b>sfFactoryException</b> If a routing implementation instance cannot 33 * @throws <b>sfFactoryException</b> If a routing implementation instance cannot be created 34 34 */ 35 35 public static function newInstance($class) 36 36 { 37 // the class exists38 37 $object = new $class(); 39 38 … … 49 48 * Initializes this sfRouting instance. 50 49 * 51 * @param sfLogger A sfLogger instance (or null)52 * @param arrayAn associative array of initialization parameters.50 * @param sfEventDispatcher A sfEventDispatcher instance 51 * @param array An associative array of initialization parameters. 53 52 * 54 * @return booltrue, if initialization completes successfully, otherwise false.53 * @return Boolean true, if initialization completes successfully, otherwise false. 55 54 * 56 * @throws <b>sfInitializationException</b> If an error occurs while initializing this User.55 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfRouting. 57 56 */ 58 public function initialize(sf Logger $logger = null, $parameters = array())57 public function initialize(sfEventDispatcher $dispatcher, $parameters = array()) 59 58 { 60 $this-> logger = $logger;59 $this->dispatcher = $dispatcher; 61 60 62 61 if (!isset($parameters['default_module'])) … … 72 71 $this->parameterHolder = new sfParameterHolder(); 73 72 $this->parameterHolder->add($parameters); 73 74 $this->dispatcher->connect('user.change_culture', array($this, 'listenToChangeCultureEvent')); 75 $this->dispatcher->connect('request.load_parameters', array($this, 'listenToLoadParametersInfoEvent')); 74 76 } 75 77 … … 131 133 * 132 134 * @return array An array of parameters 135 * 136 * @throws sfError404Exception if the url is not parseable by the sfRouting object 133 137 */ 134 138 abstract public function parse($url); … … 156 160 157 161 /** 162 * Listens to the user.change_culture event. 163 * 164 * @param sfEvent An sfEvent instance 165 * 166 */ 167 public function listenToChangeCultureEvent(sfEvent $event) 168 { 169 // change the culture in the routing default parameters 170 $this->setDefaultParameter('sf_culture', $event->getParameter('culture')); 171 } 172 173 /** 174 * Listens to the request.load_parameters event. 175 * 176 * @param sfEvent An sfEvent instance 177 * 178 */ 179 public function listenToLoadParametersInfoEvent(sfEvent $event, $parameters) 180 { 181 return array_merge($parameters, $this->parse($event->getParameter('path_info'))); 182 } 183 184 /** 158 185 * Execute the shutdown procedure. 159 186 * trunk/lib/user/sfBasicSecurityUser.class.php
r4593 r4951 65 65 if (sfConfig::get('sf_logging_enabled')) 66 66 { 67 $this-> context->getLogger()->info('{sfUser} remove credential "'.$credential.'"');67 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Remove credential "%s"', $credential)))); 68 68 } 69 69 … … 99 99 if (sfConfig::get('sf_logging_enabled')) 100 100 { 101 $this-> context->getLogger()->info('{sfUser} add credential(s) "'.implode(', ', $credentials).'"');101 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Add credential(s) "%s"', implode(', ', $credentials))))); 102 102 } 103 103 … … 174 174 if (sfConfig::get('sf_logging_enabled')) 175 175 { 176 $this-> context->getLogger()->info('{sfUser} user is '.($authenticated === true ? '' : 'not ').'authenticated');176 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('User is %sauthenticated', $authenticated === true ? '' : 'not ')))); 177 177 } 178 178 … … 208 208 } 209 209 210 public function initialize($context, $parameters = null) 210 /** 211 * Initializes this sfUser. 212 * 213 * @param sfEventDispatcher A sfEventDispatcher instance. 214 * @param sfStorage A sfStorage instance. 215 * @param array An associative array of initialization parameters. 216 * 217 * @return Boolean true, if initialization completes successfully, otherwise false. 218 * 219 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfUser. 220 */ 221 public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $parameters = array()) 211 222 { 212 223 // initialize parent 213 parent::initialize($ context, $parameters);224 parent::initialize($dispatcher, $storage, $parameters); 214 225 215 226 // read data from storage 216 $storage = $this->context->getStorage();217 218 227 $this->authenticated = $storage->read(self::AUTH_NAMESPACE); 219 228 $this->credentials = $storage->read(self::CREDENTIAL_NAMESPACE); … … 231 240 if (sfConfig::get('sf_logging_enabled')) 232 241 { 233 $this->context->getLogger()->info('{sfUser} automatic user logout'); 234 } 242 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Automatic user logout'))); 243 } 244 235 245 $this->setTimedOut(); 236 246 $this->clearCredentials(); … … 243 253 public function shutdown() 244 254 { 245 $storage = $this->context->getStorage();246 247 255 // write the last request time to the storage 248 $ storage->write(self::LAST_REQUEST_NAMESPACE, $this->lastRequest);249 250 $ storage->write(self::AUTH_NAMESPACE, $this->authenticated);251 $ storage->write(self::CREDENTIAL_NAMESPACE, $this->credentials);256 $this->storage->write(self::LAST_REQUEST_NAMESPACE, $this->lastRequest); 257 258 $this->storage->write(self::AUTH_NAMESPACE, $this->authenticated); 259 $this->storage->write(self::CREDENTIAL_NAMESPACE, $this->credentials); 252 260 253 261 // call the parent shutdown method trunk/lib/user/sfUser.class.php
r4934 r4951 36 36 $attributeHolder = null, 37 37 $culture = null, 38 $context = null; 39 40 /** 41 * Retrieve the current application context. 42 * 43 * @return Context A Context instance. 44 */ 45 public function getContext() 46 { 47 return $this->context; 48 } 49 50 /** 51 * Initialize this User. 52 * 53 * @param sfContext A sfContext instance. 54 * @param array An associative array of initialization parameters. 55 * 56 * @return Boolean true, if initialization completes successfully, otherwise false. 38 $storage = null, 39 $dispatcher = null; 40 41 /** 42 * Initializes this sfUser. 43 * 44 * @param sfEventDispatcher A sfEventDispatcher instance. 45 * @param sfStorage A sfStorage instance. 46 * @param array An associative array of initialization parameters. 47 * 48 * @return Boolean true, if initialization completes successfully, otherwise false. 57 49 * 58 50 * @throws <b>sfInitializationException</b> If an error occurs while initializing this sfUser. 59 51 */ 60 public function initialize($context, $parameters = array()) 61 { 62 $this->context = $context; 52 public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $parameters = array()) 53 { 54 $this->dispatcher = $dispatcher; 55 $this->storage = $storage; 63 56 64 57 $this->parameterHolder = new sfParameterHolder(); … … 68 61 69 62 // read attributes from storage 70 $attributes = $ context->getStorage()->read(self::ATTRIBUTE_NAMESPACE);63 $attributes = $storage->read(self::ATTRIBUTE_NAMESPACE); 71 64 if (is_array($attributes)) 72 65 { … … 81 74 // - use the culture defined in the user session 82 75 // - use the default culture set in i18n.yml 83 if (!($culture = $context->getRequest()->getParameter('sf_culture'))) 84 { 85 if (null === ($culture = $context->getStorage()->read(self::CULTURE_NAMESPACE))) 86 { 87 $culture = sfConfig::get('sf_i18n_default_culture', 'en'); 88 } 89 } 76 $currentCulture = $storage->read(self::CULTURE_NAMESPACE); 77 $culture = $this->parameterHolder->get('culture', !is_null($currentCulture) ? $currentCulture : $this->parameterHolder->get('default_culture', 'en')); 90 78 91 79 $this->setCulture($culture); … … 96 84 if (sfConfig::get('sf_logging_enabled')) 97 85 { 98 $this-> context->getLogger()->info(sprintf('{sfUser} flag old flash messages ("%s")', implode('", "', $names)));86 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Flag old flash messages ("%s")', implode('", "', $names))))); 99 87 } 100 88 … … 138 126 $this->culture = $culture; 139 127 140 // change the message format object with the new culture 141 if (sfConfig::get('sf_i18n')) 142 { 143 $this->context->getI18N()->setCulture($culture); 144 } 145 146 // change the culture in the routing default parameters 147 $this->context->getRouting()->setDefaultParameter('sf_culture', $culture); 128 $this->dispatcher->notify(new sfEvent($this, 'user.change_culture', array('culture' => $culture))); 148 129 } 149 130 } … … 272 253 if (sfConfig::get('sf_logging_enabled')) 273 254 { 274 $this-> context->getLogger()->info(sprintf('{sfUser} remove old flash messages ("%s")', implode('", "', $names)));255 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Remove old flash messages ("%s")', implode('", "', $names))))); 275 256 } 276 257 … … 282 263 } 283 264 284 $storage = $this->context->getStorage();285 286 265 $attributes = array(); 287 266 foreach ($this->attributeHolder->getNamespaces() as $namespace) … … 291 270 292 271 // write attributes to the storage 293 $ storage->write(self::ATTRIBUTE_NAMESPACE, $attributes);272 $this->storage->write(self::ATTRIBUTE_NAMESPACE, $attributes); 294 273 295 274 // write culture to the storage 296 $ storage->write(self::CULTURE_NAMESPACE, $this->culture);275 $this->storage->write(self::CULTURE_NAMESPACE, $this->culture); 297 276 298 277 session_write_close(); 299 278 } 300 279 280 /** 281 * Calls methods defined via sfEventDispatcher. 282 * 283 * @param string The method name 284 * @param array The method arguments 285 * 286 * @return mixed The returned value of the called method 287 * 288 * @throws <b>sfException</b> If the calls fails 289 */ 301 290 public function __call($method, $arguments) 302 291 { 303 if (!$callable = sfMixer::getCallable('sfUser:'.$method)) 292 $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'user.method_not_found', array('method' => $method, 'arguments' => $arguments))); 293 if (!$event->isProcessed()) 304 294 { 305 295 throw new sfException(sprintf('Call to undefined method sfUser::%s.', $method)); 306 296 } 307 297 308 array_unshift($arguments, $this); 309 310 return call_user_func_array($callable, $arguments); 298 return $event->getReturnValue(); 311 299 } 312 300 } trunk/lib/util/sfContext.class.php
r4895 r4951 24 24 { 25 25 protected 26 $factories = array(); 26 $dispatcher = null, 27 $factories = array(); 27 28 28 29 protected static … … 35 36 public function initialize() 36 37 { 38 $this->dispatcher = new sfEventDispatcher(); 39 37 40 if (sfConfig::get('sf_use_database')) 38 41 { … … 99 102 { 100 103 self::$current = $name; 104 } 105 106 /** 107 * Retrieves the current event dispatcher. 108 * 109 * @return sfEventDispatcher A sfEventDispatcher instance 110 */ 111 public function getEventDispatcher() 112 { 113 return $this->dispatcher; 101 114 } 102 115 trunk/lib/validator/sfValidatorManager.class.php
r4283 r4951 47 47 if (sfConfig::get('sf_logging_enabled')) 48 48 { 49 sfContext::getInstance()->get Logger()->info('{sfValidator} validation execution');49 sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($this, 'application.log', array('Validation execution'))); 50 50 } 51 51 trunk/lib/view/sfMailView.class.php
r4906 r4951 82 82 if (sfConfig::get('sf_logging_enabled')) 83 83 { 84 $this-> context->getLogger()->info('{sfMailView} send email to client');84 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Send email to client'))); 85 85 } 86 86 trunk/lib/view/sfPHPView.class.php
r4906 r4951 58 58 if (sfConfig::get('sf_logging_enabled')) 59 59 { 60 $this-> context->getLogger()->info(sprintf('{sfView} render "%s"', $_sfFile));60 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Render "%s"', $_sfFile)))); 61 61 } 62 62 … … 121 121 if (sfConfig::get('sf_logging_enabled')) 122 122 { 123 $this-> context->getLogger()->info(sprintf('{sfView} decorate content with "%s"', $this->getDecoratorDirectory().'/'.$this->getDecoratorTemplate()));123 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Decorate content with "%s/%s"', $this->getDecoratorDirectory(), $this->getDecoratorTemplate())))); 124 124 } 125 125 trunk/lib/view/sfView.class.php
r4933 r4951 71 71 protected 72 72 $context = null, 73 $dispatcher = null, 73 74 $decorator = false, 74 75 $decoratorDirectory = null, … … 95 96 96 97 /** 97 * Retrieves the current application context.98 *99 * @return sfContext The current sfContext instance100 */101 public final function getContext()102 {103 return $this->context;104 }105 106 /**107 98 * Retrieves this views decorator template directory. 108 99 * … … 165 156 public function initialize($context, $moduleName, $actionName, $viewName) 166 157 { 167 if (sfConfig::get('sf_logging_enabled'))168 {169 $context->getLogger()->info(sprintf('{sfView} initialize view for "%s/%s"', $moduleName, $actionName));170 }171 172 158 $this->moduleName = $moduleName; 173 159 $this->actionName = $actionName; 174 160 $this->viewName = $viewName; 175 161 176 $this->context = $context; 162 $this->context = $context; 163 $this->dispatcher = $context->getEventDispatcher(); 164 165 if (sfConfig::get('sf_logging_enabled')) 166 { 167 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Initialize view for "%s/%s"', $moduleName, $actionName)))); 168 } 177 169 178 170 $this->attributeHolder = false === sfConfig::get('sf_escaping_method') ? new sfViewParameterHolder() : new sfEscapedViewParameterHolder(); … … 478 470 479 471 /** 480 * Overloads a given method481 * 482 * @param string Method name483 * @param string Method arguments484 * 485 * @return mixed User function callback486 * 487 * @throws <b>sfException</b> If the call fails472 * Calls methods defined via sfEventDispatcher. 473 * 474 * @param string The method name 475 * @param array The method arguments 476 * 477 * @return mixed The returned value of the called method 478 * 479 * @throws <b>sfException</b> If the calls fails 488 480 */ 489 481 public function __call($method, $arguments) 490 482 { 491 if (!$callable = sfMixer::getCallable('sfView:'.$method)) 483 $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'view.method_not_found', array('method' => $method, 'arguments' => $arguments))); 484 if (!$event->isProcessed()) 492 485 { 493 486 throw new sfException(sprintf('Call to undefined method sfView::%s.', $method)); 494 487 } 495 488 496 array_unshift($arguments, $this); 497 498 return call_user_func_array($callable, $arguments); 489 return $event->getReturnValue(); 499 490 } 500 491 } trunk/lib/view/sfViewCacheManager.class.php
r4885 r4951 27 27 $cacheConfig = array(), 28 28 $context = null, 29 $dispatcher = null, 29 30 $controller = null, 30 31 $routing = null, … … 40 41 { 41 42 $this->context = $context; 43 $this->dispatcher = $context->getEventDispatcher(); 42 44 $this->controller = $context->getController(); 43 45 … … 315 317 if (sfConfig::get('sf_logging_enabled')) 316 318 { 317 $this-> context->getLogger()->info(sprintf('{sfViewCacheManager} cache for "%s" %s', $internalUri, $retval !== null ? 'exists' : 'does not exist'));319 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Cache for "%s" %s', $internalUri, $retval !== null ? 'exists' : 'does not exist')))); 318 320 } 319 321 … … 350 352 if (sfConfig::get('sf_logging_enabled')) 351 353 { 352 $this-> context->getLogger()->info('{sfViewCacheManager} discard cache');354 $this->dispatcher->notify(new sfEvent($this, 'application.log', array('Discard cache'))); 353 355 } 354 356 … … 385 387 if (sfConfig::get('sf_logging_enabled')) 386 388 { 387 $this-> context->getLogger()->info(sprintf('{sfViewCacheManager} save cache for "%s"', $internalUri));389 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Save cache for "%s"', $internalUri)))); 388 390 } 389 391 … … 402 404 if (sfConfig::get('sf_logging_enabled')) 403 405 { 404 $this-> context->getLogger()->info(sprintf('{sfViewCacheManager} remove cache for "%s"', $internalUri));406 $this->dispatcher->notify(new sfEvent($this, 'application.log', array(sprintf('Remove cache for "%s"', $internalUri)))); 405 407 } 406 408 trunk/test/unit/action/sfComponentTest.php
r4892 r4951 52 52 $t->is($component->foo, array('bar'), '__set() populates component variables'); 53 53 54 // mixins55 require_once($_test_dir.'/unit/sf MixerTest.class.php');56 $ mixert = new sfMixerTest($t);57 $ mixert->launchTests($component, 'sfComponent');54 // new methods via sfEventDispatcher 55 require_once($_test_dir.'/unit/sfEventDispatcherTest.class.php'); 56 $dispatcherTest = new sfEventDispatcherTest($t); 57 $dispatcherTest->launchTests($context->getEventDispatcher(), $component, 'component'); trunk/test/unit/controller/sfControllerTest.php
r4440 r4951 24 24 $controller->initialize($context); 25 25 26 // mixins27 require_once($_test_dir.'/unit/sf MixerTest.class.php');28 $ mixert = new sfMixerTest($t);29 $ mixert->launchTests($controller, 'sfController');26 // new methods via sfEventDispatcher 27 require_once($_test_dir.'/unit/sfEventDispatcherTest.class.php'); 28 $dispatcherTest = new sfEventDispatcherTest($t); 29 $dispatcherTest->launchTests($context->getEventDispatcher(), $controller, 'controller'); trunk/test/unit/controller/sfWebControllerTest.php
r4440 r4951 14 14 $t = new lime_test(17, new lime_output_color()); 15 15 16 $_SERVER['HTTP_HOST'] = 'localhost'; 17 $_SERVER['SCRIPT_NAME'] = '/index.php'; 18 sfConfig::set('sf_url_format', 'PATH'); 16 19 sfConfig::set('sf_max_forwards', 10); 17 20 $context = sfContext::getInstance(array( … … 154 157 sfConfig::set('sf_charset', 'utf-8'); 155 158 ob_start(); 156 $controller->redirect(' /module/action/id/1#photos');159 $controller->redirect('module/action?id=1#photos'); 157 160 $content = ob_get_clean(); 158 $t->like($content, '~ /module/action/id/1#photos~', '->redirect() adds a refresh meta in the content');159 $t->like($context->getResponse()->getHttpHeader('Location'), '~ /module/action/id/1#photos~', '->redirect() adds a Location HTTP header');161 $t->like($content, '~http\://localhost/index.php/\?module=module&action=action&id=1#photos~', '->redirect() adds a refresh meta in the content'); 162 $t->like($context->getResponse()->getHttpHeader('Location'), '~http\://localhost/index.php/\?module=module&action=action&id=1#photos~', '->redirect() adds a Location HTTP header'); 160 163 161 164 // ->genUrl() trunk/test/unit/generator/sfGeneratorTest.php
r4440 r4951 10 10 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 require_once($_test_dir.'/unit/sfContextMock.class.php');13 12 14 $t = new lime_test( 2, new lime_output_color());13 $t = new lime_test(0, new lime_output_color()); 15 14 16 15 class myGenerator extends sfGenerator … … 19 18 } 20 19 21 $ context = sfContext::getInstance();20 $manager = new sfGeneratorManager(); 22 21 $generator = new myGenerator(); 23 $generator->initialize($context); 24 25 // mixins 26 require_once($_test_dir.'/unit/sfMixerTest.class.php'); 27 $mixert = new sfMixerTest($t); 28 $mixert->launchTests($generator, 'sfGenerator'); 22 $generator->initialize($manager); trunk/test/unit/log/sfAggregateLoggerTest.php
r4845 r4951 13 13 $t = new lime_test(6, new lime_output_color()); 14 14 15 $dispatcher = new sfEventDispatcher(); 16 15 17 require_once(dirname(__FILE__).'/../../../lib/util/sfToolkit.class.php'); 16 18 $file = sfToolkit::getTmpDir().DIRECTORY_SEPARATOR.'sf_log_file.txt'; … … 20 22 } 21 23 $fileLogger = sfLogger::newInstance('sfFileLogger'); 22 $fileLogger->initialize( array('file' => $file));24 $fileLogger->initialize($dispatcher, array('file' => $file)); 23 25 $consoleLogger = sfLogger::newInstance('sfConsoleLogger'); 24 26 … … 26 28 $t->diag('->initialize()'); 27 29 $logger = sfLogger::newInstance('sfAggregateLogger'); 28 $logger->initialize( array('loggers' => $fileLogger));30 $logger->initialize($dispatcher, array('loggers' => $fileLogger)); 29 31 $t->is($logger->getLoggers(), array($fileLogger), '->initialize() can take a "loggers" parameter'); 30 32 31 33 $logger = sfLogger::newInstance('sfAggregateLogger'); 32 $logger->initialize( array('loggers' => array($fileLogger, $consoleLogger)));34 $logger->initialize($dispatcher, array('loggers' => array($fileLogger, $consoleLogger))); 33 35 $t->is($logger->getLoggers(), array($fileLogger, $consoleLogger), '->initialize() can take a "loggers" parameter'); 34 36 trunk/test/unit/log/sfFileLoggerTest.php
r4845 r4951 20 20 } 21 21 22 $dispatcher = new sfEventDispatcher(); 23 22 24 // ->initialize() 23 25 $t->diag('->initialize()'); … … 25 27 try 26 28 { 27 $logger->initialize( );29 $logger->initialize($dispatcher); 28 30 $t->fail('->initialize() parameters must contains a "file" parameter'); 29 31 } … … 35 37 // ->log() 36 38 $t->diag('->log()'); 37 $logger->initialize( array('file' => $file));39 $logger->initialize($dispatcher, array('file' => $file)); 38 40 $logger->log('foo'); 39 41 $lines = explode("\n", file_get_contents($file)); trunk/test/unit/log/sfLoggerTest.php
r4845 r4951 27 27 } 28 28 29 $dispatcher = new sfEventDispatcher(); 30 29 31 // ->newInstance() 30 32 $t->diag('->newInstance()'); … … 51 53 // ->initialize() 52 54 $t->diag('->initialize()'); 53 $logger->initialize( array('level' => sfLogger::ERR));54 $t->is($logger->getLogLevel(), sfLogger::ERR, '->initialize() takes an array of parameters as its firstargument');55 $logger->initialize($dispatcher, array('level' => sfLogger::ERR)); 56 $t->is($logger->getLogLevel(), sfLogger::ERR, '->initialize() takes an array of parameters as its second argument'); 55 57 56 58 // ::getPriorityName() trunk/test/unit/request/sfRequestTest.php
r4895 r4951 13 13 class myRequest extends sfRequest 14 14 { 15 public function get Routing()15 public function getEventDispatcher() 16 16 { 17 return $this-> routing;17 return $this->dispatcher; 18 18 } 19 19 } … … 25 25 $t = new lime_test(53, new lime_output_color()); 26 26 27 $routing = new sfNoRouting(); 28 $routing->initialize(); 27 $dispatcher = new sfEventDispatcher(); 29 28 30 29 // ::newInstance() … … 46 45 $t->diag('->initialize()'); 47 46 $request = sfRequest::newInstance('myRequest'); 48 $request->initialize( null, $routing);49 $t->is($ routing, $request->getRouting(), '->initialize() takes a sfRouting object as its secondargument');50 $request->initialize( null, $routing, array('foo' => 'bar'));47 $request->initialize($dispatcher); 48 $t->is($dispatcher, $request->getEventDispatcher(), '->initialize() takes a sfEventDispatcher object as its first argument'); 49 $request->initialize($dispatcher, array('foo' => 'bar')); 51 50 $t->is($request->getParameter('foo'), 'bar', '->initialize() takes an array of parameters as its second argument'); 52 51 … … 68 67 // ->extractParameters() 69 68 $t->diag('->extractParameters()'); 70 $request->initialize( null, $routing, array('foo' => 'foo', 'bar' => 'bar'));69 $request->initialize($dispatcher, array('foo' => 'foo', 'bar' => 'bar')); 71 70 $t->is($request->extractParameters(array()), array(), '->extractParameters() returns parameters'); 72 71 $t->is($request->extractParameters(array('foo')), array('foo' => 'foo'), '->extractParameters() returns parameters for keys in its first parameter'); … … 74 73 75 74 $request = sfRequest::newInstance('myRequest'); 76 $request->initialize( null, $routing);75 $request->initialize($dispatcher); 77 76 78 77 // ->setError() ->hasError() ->hasErrors() ->getError() ->removeError() ->getErrorNames … … 121 120 $pht->launchTests($request, 'attribute'); 122 121 123 // mixins124 require_once($_test_dir.'/unit/sf MixerTest.class.php');125 $ mixert = new sfMixerTest($t);126 $ mixert->launchTests($request, 'sfRequest');122 // new methods via sfEventDispatcher 123 require_once($_test_dir.'/unit/sfEventDispatcherTest.class.php'); 124 $dispatcherTest = new sfEventDispatcherTest($t); 125 $dispatcherTest->launchTests($dispatcher, $request, 'request'); trunk/test/unit/response/sfResponseTest.php
r4895 r4951 23 23 $t = new lime_test(23, new lime_output_color()); 24 24 25 $dispatcher = new sfEventDispatcher(); 26 25 27 // ::newInstance() 26 28 $t->diag('::newInstance()'); … … 41 43 $t->diag('->initialize()'); 42 44 $response = sfResponse::newInstance('myResponse'); 43 $response->initialize( null, array('foo' => 'bar'));45 $response->initialize($dispatcher, array('foo' => 'bar')); 44 46 $t->is($response->getParameter('foo'), 'bar', '->initialize() takes an array of parameters as its second argument'); 45 47 … … 64 66 require_once($_test_dir.'/unit/sfParameterHolderTest.class.php'); 65 67 $response = sfResponse::newInstance('myResponse'); 66 $response->initialize( );68 $response->initialize($dispatcher); 67 69 $pht = new sfParameterHolderProxyTest($t); 68 70 $pht->launchTests($response, 'parameter'); 69 71 70 // mixins71 require_once($_test_dir.'/unit/sf MixerTest.class.php');72 $ mixert = new sfMixerTest($t);73 $ mixert->launchTests($response, 'sfResponse');72 // new methods via sfEventDispatcher 73 require_once($_test_dir.'/unit/sfEventDispatcherTest.class.php'); 74 $dispatcherTest = new sfEventDispatcherTest($t); 75 $dispatcherTest->launchTests($dispatcher, $response, 'response'); trunk/test/unit/response/sfWebResponseTest.php
r4895 r4951 26 26 } 27 27 28 $dispatcher = new sfEventDispatcher(); 29 28 30 $response = new myWebResponse(); 29 $response->initialize( );31 $response->initialize($dispatcher); 30 32 31 33 // ->getStatusCode() ->setStatusCode() … … 161 163 $t->diag('->mergeProperties()'); 162 164 $response1 = sfResponse::newInstance('myWebResponse'); 163 $response1->initialize( );165 $response1->initialize($dispatcher); 164 166 $response2 = sfResponse::newInstance('myWebResponse'); 165 $response2->initialize( );167 $response2->initialize($dispatcher); 166 168 167 169 $response1->setHttpHeader('symfony', 'foo'); … … 177 179 $t->diag('->addStylesheet()'); 178 180 $response = sfResponse::newInstance('myWebResponse'); 179 $response->initialize( );181 $response->initialize($dispatcher); 180 182 $response->addStylesheet('test'); 181 183 $t->ok($response->getParameterHolder()->has('test', 'helper/asset/auto/stylesheet'), '->addStylesheet() adds a new stylesheet for the response'); … … 198 200 $t->diag('->addJavascript()'); 199 201 $response = sfResponse::newInstance('myWebResponse'); 200 $response->initialize( );202 $response->initialize($dispatcher); 201 203 $response->addJavascript('test'); 202 204 $t->ok($response->getParameterHolder()->has('test', 'helper/asset/auto/javascript'), '->addJavascript() adds a new javascript for the response'); … … 222 224 $t->diag('->setHeaderOnly() ->isHeaderOnly()'); 223 225 $response = sfResponse::newInstance('myWebResponse'); 224 $response->initialize( );226 $response->initialize($dispatcher); 225 227 $t->is($response->isHeaderOnly(), false, '->isHeaderOnly() returns false if the content must be send to the client'); 226 228 $response->setHeaderOnly(true); … … 243 245 // ->serialize() ->unserialize() 244 246 $t->diag('->serialize() ->unserialize()'); 245 $t->ok($response == unserialize(serialize($response)), 'sfWebResponse implements the Serializable interface'); 247 $resp = unserialize(serialize($response)); 248 $resp->initialize($dispatcher); 249 $t->ok($response == $resp, 'sfWebResponse implements the Serializable interface'); trunk/test/unit/routing/sfNoRoutingTest.php
r4892 r4951 14 14 15 15 $routing = new sfNoRouting(); 16 $routing->initialize( );16 $routing->initialize(new sfEventDispatcher()); 17 17 18 18 // ->getCurrentInternalUri() trunk/test/unit/routing/sfPathInfoRoutingTest.php
r4892 r4951 14 14 15 15 $routing = new sfPathInfoRouting(); 16 $routing->initialize( );16 $routing->initialize(new sfEventDispatcher()); 17 17 18 18 // ->getCurrentInternalUri() trunk/test/unit/routing/sfPatternRoutingTest.php
r4899 r4951 23 23 // public methods 24 24 $r = new sfPatternRoutingTest(); 25 $r->initialize( );25 $r->initialize(new sfEventDispatcher()); 26 26 foreach (array('clearRoutes', 'connect', 'generate', 'getCurrentInternalUri', 'getCurrentRouteName', 'getRoutes', 'hasRoutes', 'parse', 'setRoutes') as $method) 27 27 { … … 270 270 $r->connect('test', '/:module', array('action' => 'index')); 271 271 $r->connect('test1', '/:module/:action/*', array()); 272 $r->connect('test3', '/', array()); 272 273 $r->parse('/'); 273 274 $t->is($r->getCurrentInternalUri(), 'default/index', '->getCurrentInternalUri() returns the internal URI for last parsed URL'); trunk/test/unit/sfContextMock.class.php
r4932 r4951 31 31 self::$instance->storage->initialize(array('session_path' => sfConfig::get('sf_test_cache_dir').'/sessions')); 32 32 33 self::$instance->dispatcher = new sfEventDispatcher(); 34 33 35 foreach ($factories as $type => $class) 34 36 { … … 38 40 39 41 return self::$instance; 42 } 43 44 public function getEventDispatcher() 45 { 46 return self::$instance->dispatcher; 40 47 } 41 48 … … 89 96 case 'routing': 90 97 case 'response': 91 $object->initialize( null, $parameters);98 $object->initialize($this->dispatcher, $parameters); 92 99 break; 93 100 case 'request': 94 $object->initialize( null, $this->routing, $parameters);101 $object->initialize($this->dispatcher, $this->routing, $parameters); 95 102 break; 96 103 default: trunk/test/unit/user/sfBasicSecurityUserTest.php
r4892 r4951 10 10 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 require_once($_test_dir.'/unit/sfContextMock.class.php');13 12 14 13 $t = new lime_test(39, new lime_output_color()); 15 14 16 class myRequest 17 { 18 public function getParameter($key) 19 { 20 if ($key == 'sf_culture') 21 { 22 return 'en'; 23 } 24 } 25 } 15 $dispatcher = new sfEventDispatcher(); 16 $storage = sfStorage::newInstance('sfSessionTestStorage'); 17 $storage->initialize(array('session_path' => sfConfig::get('sf_test_cache_dir').'/sessions')); 26 18 27 $context = sfContext::getInstance(array( 28 'routing' => 'sfPatternRouting', 29 'request' => 'myRequest', 30 'user' => 'sfBasicSecurityUser', 31 )); 32 $user = $context->user; 19 $user = new sfBasicSecurityUser(); 20 $user->initialize($dispatcher, $storage); 33 21 34 22 // ->initialize() … … 59 47 sfConfig::set('sf_timeout', 86400); 60 48 $user = new sfBasicSecurityUser(); 61 $user->initialize($context); 62 $context->user = $user; 49 $user->initialize($dispatcher, $storage); 63 50 $t->diag('->setTimedOut() ->isTimedOut()'); 64 51 $t->is($user->isTimedOut(), false, '->isTimedOut() returns false if the session is not timed out'); trunk/test/unit/user/sfUserTest.php
r4934 r4951 10 10 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 require_once($_test_dir.'/unit/sfContextMock.class.php');13 12 14 13 $t = new lime_test(39, new lime_output_color()); … … 17 16 sfConfig::set('sf_test_cache_dir', sfToolkit::getTmpDir()); 18 17 19 $context = sfContext::getInstance(array( 20 'routing' => 'sfNoRouting', 21 'request' => 'sfWebRequest', 22 'user' => 'sfUser', 23 )); 24 $user = $context->user; 25 $storage = $context->storage; 18 $dispatcher = new sfEventDispatcher(); 19 $storage = sfStorage::newInstance('sfSessionTestStorage'); 20 $storage->initialize(array('session_path' => sfConfig::get('sf_test_cache_dir').'/sessions')); 21 22 $user = new sfUser(); 23 $user->initialize($dispatcher, $storage); 26 24 27 25 // ->initialize() … … 29 27 $t->is($user->getCulture(), 'en', '->initialize() sets the culture to "en" by default'); 30 28 31 sfConfig::set('sf_i18n_default_culture', 'de');32 29 $user->setCulture(null); 33 user_flush($context);30 $user->initialize($dispatcher, $storage, array('default_culture' => 'de')); 34 31 35 $t->is($user->getCulture(), 'de', '->initialize() sets the culture to the value of sf_i18n_default_culture if available'); 32 user_flush($dispatcher, $user, $storage); 33 34 $t->is($user->getCulture(), 'de', '->initialize() sets the culture to the value of default_culture if available'); 36 35 37 36 sfConfig::set('sf_i18n_default_culture', 'fr'); 38 user_flush($ context);37 user_flush($dispatcher, $user, $storage); 39 38 $t->is($user->getCulture(), 'de', '->initialize() reads the culture from the session data if available'); 40 39 41 40 $userBis = new sfUser(); 42 $userBis->initialize($ context);41 $userBis->initialize($dispatcher, $storage); 43 42 $t->is($userBis->getCulture(), 'de', '->initialize() serializes the culture to the session data'); 44 43 … … 50 49 // ->setFlash() ->getFlash() ->hasFlash() 51 50 $t->diag('->setFlash() ->getFlash() ->hasFlash()'); 52 $user->initialize($ context, array('use_flash' => true));51 $user->initialize($dispatcher, $storage, array('use_flash' => true)); 53 52 $user->setFlash('foo', 'bar'); 54 53 $t->is($user->getFlash('foo'), 'bar', '->setFlash() sets a flash variable'); 55 54 $t->is($user->hasFlash('foo'), true, '->hasFlash() returns true if the flash variable exists'); 56 user_flush($ context, array('use_flash' => true));55 user_flush($dispatcher, $user, $storage, array('use_flash' => true)); 57 56 58 57 $userBis = new sfUser(); 59 $userBis->initialize($ context, array('use_flash' => true));58 $userBis->initialize($dispatcher, $storage, array('use_flash' => true)); 60 59 $t->is($userBis->getFlash('foo'), 'bar', '->getFlash() returns a flash previously set'); 61 60 $t->is($userBis->hasFlash('foo'), true, '->hasFlash() returns true if the flash variable exists'); 62 user_flush($ context, array('use_flash' => true));61 user_flush($dispatcher, $user, $storage, array('use_flash' => true)); 63 62 64 63 $userBis = new sfUser(); 65 $userBis->initialize($ context, array('use_flash' => true));64 $userBis->initialize($dispatcher, $storage, array('use_flash' => true)); 66 65 $t->is($userBis->getFlash('foo'), null, 'Flashes are automatically removed after the next request'); 67 66 $t->is($userBis->hasFlash('foo'), false, '->hasFlash() returns true if the flash variable exists'); … … 77 76 $pht->launchTests($user, 'attribute'); 78 77 79 // mixins80 require_once($_test_dir.'/unit/sf MixerTest.class.php');81 $ mixert = new sfMixerTest($t);82 $ mixert->launchTests($user, 'sfUser');78 // new methods via sfEventDispatcher 79 require_once($_test_dir.'/unit/sfEventDispatcherTest.class.php'); 80 $dispatcherTest = new sfEventDispatcherTest($t); 81 $dispatcherTest->launchTests($dispatcher, $user, 'user'); 83 82 84 83 $storage->clear(); 85 84 86 function user_flush($ context, $parameters = array())85 function user_flush($dispatcher, $user, $storage, $parameters = array()) 87 86 { 88 $ context->getUser()->shutdown();89 $ context->getUser()->initialize($context, $parameters);90 $parameters = $ context->getStorage()->getParameterHolder()->getAll();91 $ context->getStorage()->shutdown();92 $ context->getStorage()->initialize($parameters);87 $user->shutdown(); 88 $user->initialize($dispatcher, $storage, $parameters); 89 $parameters = $storage->getParameterHolder()->getAll(); 90 $storage->shutdown(); 91 $storage->initialize($parameters); 93 92 } trunk/test/unit/view/sfViewTest.php
r4562 r4951 12 12 require_once($_test_dir.'/unit/sfContextMock.class.php'); 13 13 14 $t = new lime_test(1 8, new lime_output_color());14 $t = new lime_test(17, new lime_output_color()); 15 15 16 16 class myView extends sfView … … 40 40 $view->initialize($context, '', '', ''); 41 41 42 // ->getContext()43 $t->diag('->getContext()');44 $view->initialize($context, '', '', '');45 $t->is($view->getContext(), $context, '->getContext() returns the current context');46 47 42 // ->isDecorator() ->setDecorator() 48 43 $t->diag('->isDecorator() ->setDecorator()'); … … 56 51 $pht->launchTests($view, 'parameter'); 57 52 58 // mixins59 require_once($_test_dir.'/unit/sf MixerTest.class.php');60 $ mixert = new sfMixerTest($t);61 $ mixert->launchTests($view, 'sfView');53 // new methods via sfEventDispatcher 54 require_once($_test_dir.'/unit/sfEventDispatcherTest.class.php'); 55 $dispatcherTest = new sfEventDispatcherTest($t); 56 $dispatcherTest->launchTests($context->getEventDispatcher(), $view, 'view');

