(Yaf >=1.0.0)
Yaf_Controller_Abstract::__construct — Constructor of Yaf_Controller_Abstract
Yaf_Controller_Abstract::__construct() is called by Yaf when a controller object is created during dispatching. It takes no arguments, and users should not call it directly. Since it is not intended to be overridden with custom logic, Yaf_Controller_Abstract::init() is provided as the userland initialization hook instead.
This function has no parameters.
No value is returned.
Example #1 Yaf_Controller_Abstract::__construct() example
<?php
class IndexController extends Yaf_Controller_Abstract
{
// __construct() is called by Yaf_Dispatcher when the controller
// is instantiated during dispatching, and should be neither
// called manually nor overridden. Define init() instead:
public function init() {
// by the time init() runs, the dispatcher has already wired
// up the controller: the request, response and view engine
// are all available
var_dump($this->getRequest() instanceof Yaf_Request_Abstract);
var_dump($this->getResponse() instanceof Yaf_Response_Abstract);
var_dump($this->getView() instanceof Yaf_View_Interface);
}
public function indexAction() {
// ...
}
}
?>The above example will output something similar to:
bool(true) bool(true) bool(true)