Beispiel #1
0
 protected function loadDI()
 {
     $this->dependencyContainer = new DI\Container();
     $this->dependencyContainer->registerShared(['dir' => function () {
         return $this->config('app.path');
     }, 'cache' => function () {
         return new \Stash\Pool(new \Stash\Driver\FileSystem(['path' => $this->config('app.path') . $this->config('app.cache_path'), 'filePermissions' => 0777, 'dirPermissions' => 0777]));
     }, 'db' => function () {
         return new Database\Database($this);
     }, 'view' => function () {
         $view = new View\View();
         if ($this->isDebug()) {
             $view->engine()->enableDebug();
             $view->engine()->addExtension(new \Twig_Extension_Debug());
         }
         $view->engine()->addExtension(new View\Extension($this, $view));
         return $view;
     }, 'models' => function () {
         return \tyurderi\ORM\EntityManager::instance($this->getDIContainer()->get('db')->PDO(), $this->isDebug() ? null : $this->getDIContainer()->get('cache'));
     }, 'json' => function () {
         return new Http\Response\Json();
     }, 'events' => function () {
         return new Event\Manager();
     }, 'plugins' => function () {
         return new Plugin\Manager($this);
     }, 'dispatcher' => function () {
         return new Dispatcher();
     }, 'session' => function () {
         return new SessionManager();
     }, 'cookies' => function () {
         return new Http\Cookies();
     }]);
     $this->dependencyContainer->register(['app' => function () {
         return $this;
     }, 'request' => function () {
         return $this->getContainer()->get('request');
     }, 'response' => function () {
         return $this->getContainer()->get('response');
     }]);
 }
Beispiel #2
0
 public function resource_urlFunction($path)
 {
     return $this->urlFunction($this->view->themePath() . '_resources/' . $path);
 }