Пример #1
0
 public function testDefaultValues()
 {
     $config = new Config();
     $this->assertNull($config->get('foo'));
     $this->assertNull($config->foo);
     $this->assertFalse($config->get('foo', false));
     $this->assertEquals('bar', $config->get('foo', 'bar'));
 }
Пример #2
0
 /**
  * @param \Exception $e
  */
 public function onExceptionShowErrorPage(\Exception $e)
 {
     try {
         $errorUrl = sprintf("/%s/%s", $this->config->get('errors.controller', 'errors'), $this->config->get('errors.action', 'error'));
         $request = new HTTP\Request($errorUrl);
         $request->setParam('exception', $e);
         $this->webApp->dispatch($request);
     } catch (\Exception $e2) {
         $this->onExceptionAbort($e);
     }
 }
Пример #3
0
 /**
  * @return \Hynage\ORM\EntityManager
  */
 public function bootstrap()
 {
     $connection = new Connection($this->config->get('uri'));
     $dbPersister = new DatabasePersistence($connection);
     $em = new EntityManager();
     $em->addPersister('database', $dbPersister);
     if ($this->config->has('entityNameFormatter')) {
         $em->setEntityNameFormatter($this->config->get('entityNameFormatter'));
     }
     if ($this->config->has('repositoryNameFormatter')) {
         $em->setRepositoryNameFormatter($this->config->get('repositoryNameFormatter'));
     }
     $this->em = $em;
     return $em;
 }
Пример #4
0
 /**
  * @return \Hynage\MVC\Controller\Front
  */
 public function bootstrap()
 {
     $front = new Front($this->application);
     $front->setController($this->config->get('defaults.controller', 'index'))->setAction($this->config->get('defaults.action', 'index'));
     return $front;
 }
Пример #5
0
 /**
  * @param string $key
  * @return HtmlElement
  */
 public function removeAttribute($key)
 {
     $this->_attributes->remove($key);
     return $this;
 }