Skip to content

Instantly share code, notes, and snippets.

@eminetto
Created December 8, 2011 23:50
Show Gist options
  • Save eminetto/1449311 to your computer and use it in GitHub Desktop.
Save eminetto/1449311 to your computer and use it in GitHub Desktop.
bootstrap do blog
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
/**
* Salva o config no registry
* @return void
* @author Elton Minetto
*/
public function _initConfig()
{
$config = new Zend_Config($this->getApplication()->getOptions(), true);
Zend_Registry::set('config', $config);
}
/**
* Inicializa a sessão
*
* @return void
* @author Elton Minetto
*/
public function _initSession()
{
$session = new Zend_Session_Namespace('Blog');
Zend_Registry::set('session', $session);
}
/**
* Inicializa o banco de dados. Somente necessário se desejado salvar a conexão no Registry
*
* @return void
* @author Elton Minetto
*/
public function _initDb()
{
$db = $this->getPluginResource('db')->getDbAdapter();
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('db', $db);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment