protected function _before()
 {
     $connection = new \Nette\Database\Connection('mysql:host=localhost;dbname=git', 'root', '');
     $structure = new \Nette\Database\Structure($connection, new \Nette\Caching\Storages\DevNullStorage());
     $context = new \Nette\Database\Context($connection, $structure);
     $database = new \WebChemistry\Parameters\Database\NetteDatabase($context);
     $this->provider = new \WebChemistry\Parameters\Provider($this->defaults, FALSE, $database);
     $this->provider->import();
 }
Beispiel #2
0
 /**
  * @param bool $hasDb
  * @param Provider $provider
  * @param Request $request
  * @param Response $response
  */
 public function __construct($hasDb, Provider $provider, Request $request, Response $response)
 {
     $this->provider = $provider;
     $this->url = $request->getUrl();
     $this->hasDb = $hasDb;
     $this->request = $request;
     if ($this->url->getQueryParameter('debug-import-parameters')) {
         $provider->import();
         $this->redirectBack();
     }
     if ($this->url->getQueryParameter('debug-parameters-cache')) {
         $provider->cleanParametersCache();
         $this->redirectBack();
     }
 }
 public function execute()
 {
     if ($this->provider) {
         $this->provider->import();
     }
 }