Created
March 24, 2010 20:33
-
-
Save kirkegaard/342752 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { | |
| protected function _initRestRoute() { | |
| // $this->bootstrap('frontController'); | |
| // $frontController = Zend_Controller_Front::getInstance(); | |
| // $restRoute = new Zend_Rest_Route($frontController, array(), array( | |
| // 'api', | |
| // 'planner' => array('event'), | |
| // )); | |
| // $frontController->getRouter()->addRoute('rest', $restRoute); | |
| } | |
| protected function _initResponse() {} | |
| protected function _initDoctrine() { | |
| // fetch the autoloader and add sfYaml and add doctrine's autoloader | |
| $autoloader = Zend_Loader_Autoloader::getInstance(); | |
| $autoloader->registerNamespace('sfYaml') | |
| ->pushAutoloader(array('Doctrine_Core', 'autoload'), 'sfYaml'); | |
| // get options from ini | |
| $doctrineConfig = $this->getOption('doctrine'); | |
| // create a new manager | |
| $manager = Doctrine_Manager::getInstance(); | |
| // sets | |
| $manager->setAttribute(Doctrine_Core::ATTR_AUTO_ACCESSOR_OVERRIDE, true); | |
| $manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_AGGRESSIVE); | |
| // $manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_PEAR); | |
| // $manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE); | |
| $manager->setAttribute(Doctrine_Core::ATTR_AUTOLOAD_TABLE_CLASSES, true); | |
| $manager->setAttribute(Doctrine_Core::ATTR_EXPORT, Doctrine_Core::EXPORT_ALL); | |
| // set our charset | |
| $manager->setCharset('utf8'); | |
| // and collate | |
| $manager->setCollate('utf8_unicode_ci'); | |
| // start up a new connection to our database | |
| $conn = Doctrine_Manager::connection($doctrineConfig['dsn'], 'onekid'); | |
| $conn->setAttribute(Doctrine_Core::ATTR_USE_NATIVE_ENUM, true); | |
| // load our models | |
| Doctrine_Core::loadModels($doctrineConfig['models_path']); | |
| // return connection for cli | |
| return $conn; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment