/** * Make controller chain by request. * * @return Chain */ protected function makeControllerChain() { $controller = $this->makeController($this->getRequest()->getControllerPath(), $this->getRequest()->getController(), $this->getRequest()->getAction()); $chain = $this->registry->getKit()->makeControllerChain(); $chain->push($controller['instance'], $controller['action']); return $chain; }
protected function setupConnectionForTableModels() { $connection = $this->registry->getDb(); if (isset($this->config['components']['db']['tableModelClass']) && $connection) { call_user_func($this->config['components']['db']['tableModelClass'] . '::setDefaultConnection', $connection); } }
protected function setupConnection() { if (!$this->registry || !$this->dbName) { throw new \RuntimeException('You must setup registry and dbName before calling this method!'); } if ($this->dbName == self::DB_MYSQL) { $this->connection = $this->registry->getMysql(); return; } $credentials = new \tables\MysqlCredentials(); $row = $credentials->findMysqlCredentials(); if (!$row) { throw new \RuntimeException('Credentials is empty'); } $row['mysql_dsn'] = preg_replace('#dbname=([\\w]+)(?=$|\\W)#i', 'dbname=' . $this->dbName, $row['mysql_dsn']); $this->connection = $credentials->createConnectionByRow($row); if (!$this->connection) { throw new \RuntimeException('Cannot create connection!'); } }
protected function getViewToShowError() { return $this->registry->getKit()->makeView(realpath(PROTECTED_PATH . '/project/views')); }