protected function initialize() { $this->logger = sfLogger::getInstance(); if (sfConfig::get('sf_logging_enabled')) { $this->logger->info('{sfContext} initialization'); } if (sfConfig::get('sf_use_database')) { $this->databaseManager = new sfDatabaseManager(); $this->databaseManager->initialize(); } $this->actionStack = new sfActionStack(); // 'config/factories.yml' config file // auto-generated by sfFactoryConfigHandler // date: 2015/09/01 13:56:04 $this->controller = sfController::newInstance(sfConfig::get('sf_factory_controller', 'sfFrontWebController')); $this->request = sfRequest::newInstance(sfConfig::get('sf_factory_request', 'sfWebRequest')); $this->response = sfResponse::newInstance(sfConfig::get('sf_factory_response', 'sfWebResponse')); $this->storage = sfStorage::newInstance(sfConfig::get('sf_factory_storage', 'sfSessionStorage')); $this->user = sfUser::newInstance(sfConfig::get('sf_factory_user', 'myUser')); $this->controller->initialize($this); $this->request->initialize($this, sfConfig::get('sf_factory_request_parameters', NULL), sfConfig::get('sf_factory_request_attributes', array())); $this->response->initialize($this, sfConfig::get('sf_factory_response_parameters', NULL)); $this->storage->initialize($this, sfConfig::get('sf_factory_storage_parameters', array('session_name' => 'symfony'))); $this->user->initialize($this, sfConfig::get('sf_factory_user_parameters', NULL)); if (sfConfig::get('sf_cache')) { $this->viewCacheManager = new sfViewCacheManager(); $this->viewCacheManager->initialize($this, sfConfig::get('sf_factory_view_cache', 'sfFileCache'), sfConfig::get('sf_factory_view_cache_parameters', array('automaticCleaningFactor' => 0, 'cacheDir' => '/Applications/MAMP/trademark/cache/backend/prod/template'))); } register_shutdown_function(array($this, 'shutdown')); }
<?php // auto-generated by sfFactoryConfigHandler // date: 2009/08/15 10:45:03 $this->controller = sfController::newInstance(sfConfig::get('sf_factory_controller', 'sfFrontWebController')); $this->request = sfRequest::newInstance(sfConfig::get('sf_factory_request', 'sfWebRequest')); $this->response = sfResponse::newInstance(sfConfig::get('sf_factory_response', 'sfWebResponse')); $this->storage = sfStorage::newInstance(sfConfig::get('sf_factory_storage', 'sfSessionStorage')); $this->user = sfUser::newInstance(sfConfig::get('sf_factory_user', 'myUser')); $this->controller->initialize($this); $this->request->initialize($this, sfConfig::get('sf_factory_request_parameters', NULL), sfConfig::get('sf_factory_request_attributes', array())); $this->response->initialize($this, sfConfig::get('sf_factory_response_parameters', NULL)); $this->storage->initialize($this, sfConfig::get('sf_factory_storage_parameters', array('session_name' => 'symfony'))); $this->user->initialize($this, sfConfig::get('sf_factory_user_parameters', NULL)); if (sfConfig::get('sf_cache')) { $this->viewCacheManager = new sfViewCacheManager(); $this->viewCacheManager->initialize($this, sfConfig::get('sf_factory_view_cache', 'sfFileCache'), sfConfig::get('sf_factory_view_cache_parameters', array('automaticCleaningFactor' => 0, 'cacheDir' => '/Users/takizo/Sites/coscupdemo/cache/frontend/dev/template'))); }
protected function initialize() { $this->logger = sfLogger::getInstance(); if (sfConfig::get('sf_logging_enabled')) { $this->logger->info('{sfContext} initialization'); } if (sfConfig::get('sf_use_database')) { $this->databaseManager = new sfDatabaseManager(); $this->databaseManager->initialize(); } $this->actionStack = new sfActionStack(); $this->controller = sfController::newInstance(sfConfig::get('sf_factory_controller', 'sfFrontWebController')); $this->request = sfRequest::newInstance(sfConfig::get('sf_factory_request', 'sfWebRequest')); $this->response = sfResponse::newInstance(sfConfig::get('sf_factory_response', 'sfWebResponse')); $this->storage = sfStorage::newInstance(sfConfig::get('sf_factory_storage', 'sfSessionStorage')); $this->user = sfUser::newInstance(sfConfig::get('sf_factory_user', 'myUser')); $this->controller->initialize($this); $this->request->initialize($this, sfConfig::get('sf_factory_request_parameters', NULL), sfConfig::get('sf_factory_request_attributes', array())); $this->response->initialize($this, sfConfig::get('sf_factory_response_parameters', NULL)); $this->storage->initialize($this, sfConfig::get('sf_factory_storage_parameters', array('session_name' => 'symfony'))); $this->user->initialize($this, sfConfig::get('sf_factory_user_parameters', NULL)); if (sfConfig::get('sf_cache')) { $this->viewCacheManager = new sfViewCacheManager(); $this->viewCacheManager->initialize($this, sfConfig::get('sf_factory_view_cache', 'sfFileCache'), sfConfig::get('sf_factory_view_cache_parameters', array('automaticCleaningFactor' => 0, 'cacheDir' => 'C:\\xampp\\htdocs\\bm400\\cache\\pmbonline\\dev\\template'))); } register_shutdown_function(array($this, 'shutdown')); }
$t->diag('->getMethod() ->setMethod()'); $request->setMethod(sfRequest::GET); $t->is($request->getMethod(), sfRequest::GET, '->getMethod() returns the current request method'); try { $request->setMethod('foo'); $t->fail('->setMethod() throws a sfException if the method is not valid'); } catch (sfException $e) { $t->pass('->setMethod() throws a sfException if the method is not valid'); } // ->extractParameters() $t->diag('->extractParameters()'); $request->initialize($context, array('foo' => 'foo', 'bar' => 'bar')); $t->is($request->extractParameters(array()), array(), '->extractParameters() returns parameters'); $t->is($request->extractParameters(array('foo')), array('foo' => 'foo'), '->extractParameters() returns parameters for keys in its first parameter'); $t->is($request->extractParameters(array('bar')), array('bar' => 'bar'), '->extractParameters() returns parameters for keys in its first parameter'); $request = sfRequest::newInstance('myRequest'); $request->initialize($context); // ->setError() ->hasError() ->hasErrors() ->getError() ->removeError() ->getErrorNames $t->diag('->setError() ->hasError() ->hasErrors() ->getError() ->removeError() ->getErrorNames'); // single error $key = "test"; $value = "error"; $request->setError($key, $value, '->setError() add an error message for the given parameter'); $t->is($request->hasError($key), true, '->hasError() returns true if an error exists for the given parameter'); $t->is($request->hasErrors(), true, '->hasErrors() returns true if there are some errors'); $t->is($request->getError($key), $value, '->getError() returns the error text for the given parameter'); $t->is($request->removeError($key), $value, '->removeError() removes the error for the given parameter'); $t->is($request->hasError($key), false, '->hasError() returns false if no error exists for the given parameter'); $t->is($request->hasErrors(), false, '->hasErrors() returns false if there is no error'); // multiple errors $key1 = "test1";