Yaf_Dispatcher::setRequest
PHP function
Edit on GitHub ✎
(Yaf >=1.0.0)
Set the request object
Description
Yaf_Dispatcher::setRequest(Yaf_Request_Abstract $request): Yaf_Dispatcher|null
Set the request object used by the dispatcher. This allows using a custom request implementation instead of the built-in Yaf_Request_Http or Yaf_Request_Simple.
Parameters
requestA
Yaf_Request_Abstractinstance.
Return Values
Returns the Yaf_Dispatcher object itself on success, or null if the application is not initialized.
Examples
Yaf_Dispatcher::setRequest example
php
<?php
$app = new Yaf_Application(dirname(__FILE__) . "/conf/application.ini");
// Run the application from a cron job:
// $ php cron.php index/index/cleanup
$request = new Yaf_Request_Simple("CLI");
Yaf_Dispatcher::getInstance()->setRequest($request);
$app->run();
?>See Also
Yaf_Dispatcher::getRequestYaf_Request_Abstract