note 107030 modified in yaf-application.bootstrap by danbrown
| From: | danbrown@php.net | Date: | Tue, 03 Jan 2012 21:49:11 +0000 |
| Subject: | note 107030 modified in yaf-application.bootstrap by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185292@lists.php.net to get a copy of this message | ||
Here is an example of a Bootstrap loading a session class then loading a database class and using a
db configuration from the application config.
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract
{
public function _initSession(Yaf_Dispatcher $dispatcher)
{
$session = new Vendor\Session();
$session->start();
}
public function _initDatabase(Yaf_Dispatcher $dispatcher)
{
$config = Yaf_Application::app()->getConfig()->application->database;
Yaf_Registry::set('db', Vendor\Database($config));
}
}
?>
--was--
Here is an example of a Bootstrap loading a session class then loading a database class and using a
db configuration from the application config.
class Bootstrap extends Yaf_Bootstrap_Abstract
{
public function _initSession(Yaf_Dispatcher $dispatcher)
{
$session = new Vendor\Session();
$session->start();
}
public function _initDatabase(Yaf_Dispatcher $dispatcher)
{
$config = Yaf_Application::app()->getConfig()->application->database;
Yaf_Registry::set('db', Vendor\Database($config));
}
}
http://php.net/manual/en/yaf-application.bootstrap.php