コード例 #1
0
 /**
  * Register an autoloader for application classes.
  * 
  * @param Container $container
  */
 public function register(Container $container)
 {
     $configuration = $container->resolve('Darya\\Foundation\\Configuration');
     $basePath = $container->get('path');
     $namespace = $configuration->get('project.namespace', 'Application');
     // Map the configured namespace to the application directory
     $autoloader = new Autoloader($basePath, array($namespace => 'application'));
     $autoloader->register();
     $container->register(array('Darya\\Common\\Autoloader' => $autoloader));
 }
コード例 #2
0
ファイル: SmartyViewService.php プロジェクト: darya/framework
 /**
  * Register a Smarty view resolver with the service container.
  * 
  * @param Container $container
  */
 public function register(Container $container)
 {
     $container->register(array('Darya\\Smarty\\ViewResolver' => function ($container) {
         $basePath = $container->get('path');
         $realBasePath = realpath("{$basePath}/views/smarty");
         $viewResolver = new ViewResolver('Darya\\Smarty\\View', $realBasePath);
         $viewResolver->shareConfig(array('base' => $realBasePath, 'cache' => '../../storage/cache', 'compile' => '../../storage/views'));
         $viewResolver->share(array('config' => $container->config));
         return $viewResolver;
     }, 'Darya\\View\\Resolver' => 'Darya\\Smarty\\ViewResolver'));
 }