Advertisement
Guest User

Untitled

a guest
Jan 28th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. <?php
  2. /** Register router */
  3. $dependencyInjector->set(
  4.     'router', function () {
  5.         $router = new \Phalcon\Mvc\Router();
  6.         require BOOTSTRAP_DIR_PATH . '/routes_frontend.php';
  7.         require BOOTSTRAP_DIR_PATH . '/routes_backend.php';
  8.         require BOOTSTRAP_DIR_PATH . '/routes_apiv1.php';
  9.  
  10.         return $router;
  11.     }
  12. );
  13.  
  14. /** Register dispatcher */
  15. $dependencyInjector->set(
  16.     'dispatcher', function () use ($dependencyInjector) {
  17. die('called');
  18.         //Obtain the standard eventsManager from the DI
  19.         $eventsManager = $dependencyInjector->getShared('eventsManager');
  20.  
  21.         //Attach the plugin to 'dispatch' events
  22.         $eventsManager->attach('dispatch', new \Crocofy\Plugin\CacheEnabler());
  23.  
  24.         $dispatcher = new Phalcon\Mvc\Dispatcher();
  25.         $dispatcher->setEventsManager($eventsManager);
  26.  
  27.         return $dispatcher;
  28.     }
  29. );
  30.  
  31. /** Register app settings */
  32. $dependencyInjector->setShared(
  33.     'config', function () {
  34.         $configs = new \Phalcon\Config(require CONFIGS_PATH . '/live.php');
  35.  
  36.         if (APPLICATION_ENV === 'staging' || APPLICATION_ENV === 'dev') {
  37.             $configs->merge(new \Phalcon\Config(require CONFIGS_PATH . '/staging.php'));
  38.         }
  39.  
  40.         if (APPLICATION_ENV === 'dev') {
  41.             $configs->merge(new \Phalcon\Config(require CONFIGS_PATH . '/dev.php'));
  42.         }
  43.  
  44.         if (APPLICATION_ENV === 'test') {
  45.             $configs->merge(new \Phalcon\Config(require CONFIGS_PATH . '/test.php'));
  46.         }
  47.  
  48.         return $configs;
  49.     }
  50. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement