<?php use rock\base\Alias; use rock\db\BatchQueryResult; use rock\rbac\Permission; use rock\rbac\Role; use rock\Rock; use rock\security\Security; use rock\template\Template; return array_merge(['route' => ['class' => \rock\route\Route::className()], 'access' => ['class' => \rock\access\Access::className()], 'behavior' => ['class' => \rock\components\Behavior::className()], 'db' => ['class' => \rock\db\Connection::className(), 'username' => 'root', 'password' => 'root', 'charset' => 'utf8', 'dsn' => 'mysql:host=localhost;dbname=rockdemo;charset=utf8', 'tablePrefix' => 'spt_', 'aliasSeparator' => '__'], 'BatchQueryResult' => ['class' => BatchQueryResult::className()], 'template' => ['class' => Template::className(), 'locale' => [\rock\LocaleProperties::className(), 'locale'], 'autoEscape' => Template::ESCAPE | Template::TO_TYPE, 'handlerLink' => function ($link, Template $template, array $params = []) { if (!($link = Alias::getAlias("@{$link}", [], false))) { return '#'; } return $template->autoEscape(\rock\template\filters\BaseFilter::modifyUrl($link, $params)); }, 'extensions' => ['cfg' => function (array $keys) { return \rock\helpers\ArrayHelper::getValue(Rock::$config, $keys); }, 'user' => function (array $keys) { if (current($keys) === 'isGuest') { return Rock::$app->user->isGuest(); } elseif (in_array(current($keys), ['isLogged', 'isAuthenticated'], true)) { return !Rock::$app->user->isGuest(); } return \rock\helpers\ArrayHelper::getValue(Rock::$app->user->getAll(), $keys); }, 'call' => function (array $call, array $params = [], Template $template) { if (!isset($call[1])) { $call[1] = null; } list($class, $method) = $call; if ($class === 'context') { $object = $template->context; $function = [$object, $method];
public function init() { parent::init(); $this->request = Instance::ensure($this->request, '\\rock\\request\\Request'); }