Commit a15a3835 by Qiang Xue

Moved all filter classes to namespace `yii\filters`

parent 50e33812
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
namespace backend\controllers; namespace backend\controllers;
use Yii; use Yii;
use yii\web\AccessControl; use yii\filters\AccessControl;
use yii\web\Controller; use yii\web\Controller;
use common\models\LoginForm; use common\models\LoginForm;
use yii\web\VerbFilter; use yii\filters\VerbFilter;
/** /**
* Site controller * Site controller
......
<?php <?php
namespace frontend\controllers; namespace frontend\controllers;
use Yii;
use common\models\LoginForm; use common\models\LoginForm;
use frontend\models\PasswordResetRequestForm; use frontend\models\PasswordResetRequestForm;
use frontend\models\ResetPasswordForm; use frontend\models\ResetPasswordForm;
...@@ -9,8 +10,8 @@ use frontend\models\ContactForm; ...@@ -9,8 +10,8 @@ use frontend\models\ContactForm;
use yii\base\InvalidParamException; use yii\base\InvalidParamException;
use yii\web\BadRequestHttpException; use yii\web\BadRequestHttpException;
use yii\web\Controller; use yii\web\Controller;
use Yii; use yii\filters\VerbFilter;
use yii\web\VerbFilter; use yii\filters\AccessControl;
/** /**
* Site controller * Site controller
...@@ -24,7 +25,7 @@ class SiteController extends Controller ...@@ -24,7 +25,7 @@ class SiteController extends Controller
{ {
return [ return [
'access' => [ 'access' => [
'class' => \yii\web\AccessControl::className(), 'class' => AccessControl::className(),
'only' => ['logout', 'signup'], 'only' => ['logout', 'signup'],
'rules' => [ 'rules' => [
[ [
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
namespace app\controllers; namespace app\controllers;
use Yii; use Yii;
use yii\web\AccessControl; use yii\filters\AccessControl;
use yii\web\Controller; use yii\web\Controller;
use yii\web\VerbFilter; use yii\filters\VerbFilter;
use app\models\LoginForm; use app\models\LoginForm;
use app\models\ContactForm; use app\models\ContactForm;
......
...@@ -7,7 +7,7 @@ of controlling it. ...@@ -7,7 +7,7 @@ of controlling it.
Access control basics Access control basics
--------------------- ---------------------
Basic access control is very simple to implement using [[yii\web\AccessControl]]: Basic access control is very simple to implement using [[yii\filters\AccessControl]]:
```php ```php
class SiteController extends Controller class SiteController extends Controller
...@@ -16,7 +16,7 @@ class SiteController extends Controller ...@@ -16,7 +16,7 @@ class SiteController extends Controller
{ {
return [ return [
'access' => [ 'access' => [
'class' => \yii\web\AccessControl::className(), 'class' => \yii\filters\AccessControl::className(),
'only' => ['login', 'logout', 'signup'], 'only' => ['login', 'logout', 'signup'],
'rules' => [ 'rules' => [
[ [
...@@ -38,7 +38,7 @@ class SiteController extends Controller ...@@ -38,7 +38,7 @@ class SiteController extends Controller
In the code above we're attaching access control behavior to a controller. Since there's `only` option specified, it In the code above we're attaching access control behavior to a controller. Since there's `only` option specified, it
will be applied to 'login', 'logout' and 'signup' actions only. A set of rules that are basically options for will be applied to 'login', 'logout' and 'signup' actions only. A set of rules that are basically options for
[[yii\web\AccessRule]] reads as follows: [[yii\filters\AccessRule]] reads as follows:
- Allow all guest (not yet authenticated) users to access 'login' and 'signup' actions. - Allow all guest (not yet authenticated) users to access 'login' and 'signup' actions.
- Allow authenticated users to access 'logout' action. - Allow authenticated users to access 'logout' action.
...@@ -46,7 +46,7 @@ will be applied to 'login', 'logout' and 'signup' actions only. A set of rules t ...@@ -46,7 +46,7 @@ will be applied to 'login', 'logout' and 'signup' actions only. A set of rules t
Rules are checked one by one from top to bottom. If rule matches, action takes place immediately. If not, next rule is Rules are checked one by one from top to bottom. If rule matches, action takes place immediately. If not, next rule is
checked. If no rules matched access is denied. checked. If no rules matched access is denied.
[[yii\web\AccessRule]] is quite flexible and allows additionally to what was demonstrated checking IPs and request method [[yii\filters\AccessRule]] is quite flexible and allows additionally to what was demonstrated checking IPs and request method
(i.e. POST, GET). If it's not enough you can specify your own check via anonymous function: (i.e. POST, GET). If it's not enough you can specify your own check via anonymous function:
```php ```php
...@@ -56,7 +56,7 @@ class SiteController extends Controller ...@@ -56,7 +56,7 @@ class SiteController extends Controller
{ {
return [ return [
'access' => [ 'access' => [
'class' => \yii\web\AccessControl::className(), 'class' => \yii\filters\AccessControl::className(),
'only' => ['special-callback'], 'only' => ['special-callback'],
'rules' => [ 'rules' => [
[ [
...@@ -219,7 +219,7 @@ public function behaviors() ...@@ -219,7 +219,7 @@ public function behaviors()
{ {
return [ return [
'access' => [ 'access' => [
'class' => 'yii\web\AccessControl', 'class' => 'yii\filters\AccessControl',
'except' => ['something'], 'except' => ['something'],
'rules' => [ 'rules' => [
[ [
......
...@@ -199,7 +199,7 @@ public function behaviors() ...@@ -199,7 +199,7 @@ public function behaviors()
{ {
return [ return [
'httpCache' => [ 'httpCache' => [
'class' => \yii\web\HttpCache::className(), 'class' => \yii\filters\HttpCache::className(),
'only' => ['index'], 'only' => ['index'],
'lastModified' => function ($action, $params) { 'lastModified' => function ($action, $params) {
$q = new \yii\db\Query(); $q = new \yii\db\Query();
...@@ -225,8 +225,8 @@ The return value of [[yii\base\ActionFilter::beforeAction()|beforeAction()]] det ...@@ -225,8 +225,8 @@ The return value of [[yii\base\ActionFilter::beforeAction()|beforeAction()]] det
an action should be executed or not. If `beforeAction()` of a filter returns false, the filters after this one an action should be executed or not. If `beforeAction()` of a filter returns false, the filters after this one
will be skipped and the action will not be executed. will be skipped and the action will not be executed.
The [authorization](authorization.md) section of this guide shows how to use the [[yii\web\AccessControl]] filter, The [authorization](authorization.md) section of this guide shows how to use the [[yii\filters\AccessControl]] filter,
and the [caching](caching.md) section gives more details about the [[yii\web\PageCache]] and [[yii\web\HttpCache]] filters. and the [caching](caching.md) section gives more details about the [[yii\filters\PageCache]] and [[yii\filters\HttpCache]] filters.
These built-in filters are also good references when you learn to create your own filters. These built-in filters are also good references when you learn to create your own filters.
......
...@@ -137,7 +137,7 @@ sending either `ETag` or `Last-Modified` header in your application response. If ...@@ -137,7 +137,7 @@ sending either `ETag` or `Last-Modified` header in your application response. If
HTTP specification (most browsers are), content will be fetched only if it is different from what it was prevously. HTTP specification (most browsers are), content will be fetched only if it is different from what it was prevously.
Forming proper headers is time consuming task so Yii provides a shortcut in form of controller filter Forming proper headers is time consuming task so Yii provides a shortcut in form of controller filter
[[yii\web\HttpCache]]. Using it is very easy. In a controller you need to implement `behaviors` method like [[yii\filters\HttpCache]]. Using it is very easy. In a controller you need to implement `behaviors` method like
the following: the following:
```php ```php
...@@ -145,7 +145,7 @@ public function behaviors() ...@@ -145,7 +145,7 @@ public function behaviors()
{ {
return [ return [
'httpCache' => [ 'httpCache' => [
'class' => \yii\web\HttpCache::className(), 'class' => \yii\filters\HttpCache::className(),
'only' => ['list'], 'only' => ['list'],
'lastModified' => function ($action, $params) { 'lastModified' => function ($action, $params) {
$q = new Query(); $q = new Query();
......
...@@ -13,7 +13,7 @@ In particular, Yii provides support for the following aspects regarding RESTful ...@@ -13,7 +13,7 @@ In particular, Yii provides support for the following aspects regarding RESTful
* Authentication; * Authentication;
* Authorization; * Authorization;
* Support for HATEOAS; * Support for HATEOAS;
* Caching via `yii\web\HttpCache`; * Caching via `yii\filters\HttpCache`;
* Rate limiting; * Rate limiting;
* Searching and filtering: TBD * Searching and filtering: TBD
* Testing: TBD * Testing: TBD
...@@ -783,7 +783,7 @@ Accept: application/vnd.company.myapp-v1+json ...@@ -783,7 +783,7 @@ Accept: application/vnd.company.myapp-v1+json
``` ```
Both methods have pros and cons, and there are a lot of debates about them. Below we describe a practical strategy Both methods have pros and cons, and there are a lot of debates about them. Below we describe a practical strategy
of API versioning that is a kind of mix of these two methods: of API versioning that is kind of a mix of these two methods:
* Put each major version of API implementation in a separate module whose ID is the major version number (e.g. `v1`, `v2`). * Put each major version of API implementation in a separate module whose ID is the major version number (e.g. `v1`, `v2`).
Naturally, the API URLs will contain major version numbers. Naturally, the API URLs will contain major version numbers.
...@@ -793,7 +793,9 @@ of API versioning that is a kind of mix of these two methods: ...@@ -793,7 +793,9 @@ of API versioning that is a kind of mix of these two methods:
For each module serving a major version, it should include the resource classes and the controller classes For each module serving a major version, it should include the resource classes and the controller classes
serving for that specific version. To better separate code responsibility, you may keep a common set of serving for that specific version. To better separate code responsibility, you may keep a common set of
base resource and controller classes, and subclass them in each individual version module. Within the subclasses, base resource and controller classes, and subclass them in each individual version module. Within the subclasses,
implement the concrete code such as `Model::fields()`. As a result, your code may be organized like the following: implement the concrete code such as `Model::fields()`.
Your code may be organized like the following:
``` ```
api/ api/
......
...@@ -318,7 +318,7 @@ Action Filters ...@@ -318,7 +318,7 @@ Action Filters
Action filters are implemented via behaviors now. You should extend from [[yii\base\ActionFilter]] to Action filters are implemented via behaviors now. You should extend from [[yii\base\ActionFilter]] to
define a new filter. To use a filter, you should attach the filter class to the controller define a new filter. To use a filter, you should attach the filter class to the controller
as a behavior. For example, to use the [[yii\web\AccessControl]] filter, you should have the following as a behavior. For example, to use the [[yii\filters\AccessControl]] filter, you should have the following
code in a controller: code in a controller:
```php ```php
...@@ -326,7 +326,7 @@ public function behaviors() ...@@ -326,7 +326,7 @@ public function behaviors()
{ {
return [ return [
'access' => [ 'access' => [
'class' => 'yii\web\AccessControl', 'class' => 'yii\filters\AccessControl',
'rules' => [ 'rules' => [
['allow' => true, 'actions' => ['admin'], 'roles' => ['@']], ['allow' => true, 'actions' => ['admin'], 'roles' => ['@']],
], ],
......
...@@ -232,7 +232,7 @@ return [ ...@@ -232,7 +232,7 @@ return [
### Handling REST requests ### Handling REST requests
TBD: TBD:
- RESTful routing: [[yii\web\VerbFilter]], [[yii\web\UrlManager::$rules]] - RESTful routing: [[yii\filters\VerbFilter]], [[yii\filters\UrlManager::$rules]]
- Json API: - Json API:
- response: [[yii\web\Response::format]] - response: [[yii\web\Response::format]]
- request: [[yii\web\Request::$parsers]], [[yii\web\JsonParser]] - request: [[yii\web\Request::$parsers]], [[yii\web\JsonParser]]
......
...@@ -34,7 +34,7 @@ use <?= ltrim($generator->modelClass, '\\') ?>; ...@@ -34,7 +34,7 @@ use <?= ltrim($generator->modelClass, '\\') ?>;
use <?= ltrim($generator->searchModelClass, '\\') . (isset($searchModelAlias) ? " as $searchModelAlias" : "") ?>; use <?= ltrim($generator->searchModelClass, '\\') . (isset($searchModelAlias) ? " as $searchModelAlias" : "") ?>;
use <?= ltrim($generator->baseControllerClass, '\\') ?>; use <?= ltrim($generator->baseControllerClass, '\\') ?>;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\web\VerbFilter; use yii\filters\VerbFilter;
/** /**
* <?= $controllerClass ?> implements the CRUD actions for <?= $modelClass ?> model. * <?= $controllerClass ?> implements the CRUD actions for <?= $modelClass ?> model.
......
...@@ -274,6 +274,7 @@ Yii Framework 2 Change Log ...@@ -274,6 +274,7 @@ Yii Framework 2 Change Log
- Chg: `Yii::$objectConfig` is removed. You should use `Yii::$container->set()` to configure default settings of classes. (qiangxue) - Chg: `Yii::$objectConfig` is removed. You should use `Yii::$container->set()` to configure default settings of classes. (qiangxue)
- Chg: Removed `yii\grid\Column::getDataCellContent()` and renamed `yii\grid\DataColumn::getDataCellContent()` to `yii\grid\DataColumn::getDataCellValue()` (cebe) - Chg: Removed `yii\grid\Column::getDataCellContent()` and renamed `yii\grid\DataColumn::getDataCellContent()` to `yii\grid\DataColumn::getDataCellValue()` (cebe)
- Chg: `yii\log\Logger` is split into `yii\log\Logger` and `yii\log\Dispatcher`. (qiangxue) - Chg: `yii\log\Logger` is split into `yii\log\Logger` and `yii\log\Dispatcher`. (qiangxue)
- Chg: Moved all filter classes to namespace `yii\filters` (qiangxue)
- New #66: [Auth client library](https://github.com/yiisoft/yii2-authclient) OpenId, OAuth1, OAuth2 clients (klimov-paul) - New #66: [Auth client library](https://github.com/yiisoft/yii2-authclient) OpenId, OAuth1, OAuth2 clients (klimov-paul)
- New #303: Added built-in support for REST API (qiangxue) - New #303: Added built-in support for REST API (qiangxue)
- New #503: Added `yii\di\Container` and `yii\di\ServiceLocator` (qiangxue) - New #503: Added `yii\di\Container` and `yii\di\ServiceLocator` (qiangxue)
......
...@@ -13,7 +13,7 @@ namespace yii\base; ...@@ -13,7 +13,7 @@ namespace yii\base;
* An action filter will participate in the action execution workflow by responding to * An action filter will participate in the action execution workflow by responding to
* the `beforeAction` and `afterAction` events triggered by modules and controllers. * the `beforeAction` and `afterAction` events triggered by modules and controllers.
* *
* Check implementation of [[\yii\web\AccessControl]], [[\yii\web\PageCache]] and [[\yii\web\HttpCache]] as examples on how to use it. * Check implementation of [[\yii\filters\AccessControl]], [[\yii\filters\PageCache]] and [[\yii\filters\HttpCache]] as examples on how to use it.
* *
* @author Qiang Xue <qiang.xue@gmail.com> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
......
...@@ -227,8 +227,8 @@ return [ ...@@ -227,8 +227,8 @@ return [
'yii\validators\UrlValidator' => YII_PATH . '/validators/UrlValidator.php', 'yii\validators\UrlValidator' => YII_PATH . '/validators/UrlValidator.php',
'yii\validators\ValidationAsset' => YII_PATH . '/validators/ValidationAsset.php', 'yii\validators\ValidationAsset' => YII_PATH . '/validators/ValidationAsset.php',
'yii\validators\Validator' => YII_PATH . '/validators/Validator.php', 'yii\validators\Validator' => YII_PATH . '/validators/Validator.php',
'yii\web\AccessControl' => YII_PATH . '/web/AccessControl.php', 'yii\filters\AccessControl' => YII_PATH . '/filters/AccessControl.php',
'yii\web\AccessRule' => YII_PATH . '/web/AccessRule.php', 'yii\filters\AccessRule' => YII_PATH . '/filters/AccessRule.php',
'yii\web\Application' => YII_PATH . '/web/Application.php', 'yii\web\Application' => YII_PATH . '/web/Application.php',
'yii\web\AssetBundle' => YII_PATH . '/web/AssetBundle.php', 'yii\web\AssetBundle' => YII_PATH . '/web/AssetBundle.php',
'yii\web\AssetConverter' => YII_PATH . '/web/AssetConverter.php', 'yii\web\AssetConverter' => YII_PATH . '/web/AssetConverter.php',
...@@ -246,7 +246,7 @@ return [ ...@@ -246,7 +246,7 @@ return [
'yii\web\ForbiddenHttpException' => YII_PATH . '/web/ForbiddenHttpException.php', 'yii\web\ForbiddenHttpException' => YII_PATH . '/web/ForbiddenHttpException.php',
'yii\web\GoneHttpException' => YII_PATH . '/web/GoneHttpException.php', 'yii\web\GoneHttpException' => YII_PATH . '/web/GoneHttpException.php',
'yii\web\HeaderCollection' => YII_PATH . '/web/HeaderCollection.php', 'yii\web\HeaderCollection' => YII_PATH . '/web/HeaderCollection.php',
'yii\web\HttpCache' => YII_PATH . '/web/HttpCache.php', 'yii\filters\HttpCache' => YII_PATH . '/filters/HttpCache.php',
'yii\web\HttpException' => YII_PATH . '/web/HttpException.php', 'yii\web\HttpException' => YII_PATH . '/web/HttpException.php',
'yii\web\IdentityInterface' => YII_PATH . '/web/IdentityInterface.php', 'yii\web\IdentityInterface' => YII_PATH . '/web/IdentityInterface.php',
'yii\web\JqueryAsset' => YII_PATH . '/web/JqueryAsset.php', 'yii\web\JqueryAsset' => YII_PATH . '/web/JqueryAsset.php',
...@@ -257,7 +257,7 @@ return [ ...@@ -257,7 +257,7 @@ return [
'yii\web\MethodNotAllowedHttpException' => YII_PATH . '/web/MethodNotAllowedHttpException.php', 'yii\web\MethodNotAllowedHttpException' => YII_PATH . '/web/MethodNotAllowedHttpException.php',
'yii\web\NotAcceptableHttpException' => YII_PATH . '/web/NotAcceptableHttpException.php', 'yii\web\NotAcceptableHttpException' => YII_PATH . '/web/NotAcceptableHttpException.php',
'yii\web\NotFoundHttpException' => YII_PATH . '/web/NotFoundHttpException.php', 'yii\web\NotFoundHttpException' => YII_PATH . '/web/NotFoundHttpException.php',
'yii\web\PageCache' => YII_PATH . '/web/PageCache.php', 'yii\filters\PageCache' => YII_PATH . '/filters/PageCache.php',
'yii\web\PrefixUrlRule' => YII_PATH . '/web/PrefixUrlRule.php', 'yii\web\PrefixUrlRule' => YII_PATH . '/web/PrefixUrlRule.php',
'yii\web\Request' => YII_PATH . '/web/Request.php', 'yii\web\Request' => YII_PATH . '/web/Request.php',
'yii\web\RequestParserInterface' => YII_PATH . '/web/RequestParserInterface.php', 'yii\web\RequestParserInterface' => YII_PATH . '/web/RequestParserInterface.php',
...@@ -274,7 +274,7 @@ return [ ...@@ -274,7 +274,7 @@ return [
'yii\web\UrlRuleInterface' => YII_PATH . '/web/UrlRuleInterface.php', 'yii\web\UrlRuleInterface' => YII_PATH . '/web/UrlRuleInterface.php',
'yii\web\User' => YII_PATH . '/web/User.php', 'yii\web\User' => YII_PATH . '/web/User.php',
'yii\web\UserEvent' => YII_PATH . '/web/UserEvent.php', 'yii\web\UserEvent' => YII_PATH . '/web/UserEvent.php',
'yii\web\VerbFilter' => YII_PATH . '/web/VerbFilter.php', 'yii\filters\VerbFilter' => YII_PATH . '/filters/VerbFilter.php',
'yii\web\View' => YII_PATH . '/web/View.php', 'yii\web\View' => YII_PATH . '/web/View.php',
'yii\web\XmlResponseFormatter' => YII_PATH . '/web/XmlResponseFormatter.php', 'yii\web\XmlResponseFormatter' => YII_PATH . '/web/XmlResponseFormatter.php',
'yii\web\YiiAsset' => YII_PATH . '/web/YiiAsset.php', 'yii\web\YiiAsset' => YII_PATH . '/web/YiiAsset.php',
......
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yii\web; namespace yii\filters;
use Yii; use Yii;
use yii\base\Action; use yii\base\Action;
use yii\base\ActionFilter; use yii\base\ActionFilter;
use yii\web\User;
use yii\web\ForbiddenHttpException;
/** /**
* AccessControl provides simple access control based on a set of rules. * AccessControl provides simple access control based on a set of rules.
...@@ -28,7 +30,7 @@ use yii\base\ActionFilter; ...@@ -28,7 +30,7 @@ use yii\base\ActionFilter;
* { * {
* return [ * return [
* 'access' => [ * 'access' => [
* 'class' => \yii\web\AccessControl::className(), * 'class' => \yii\filters\AccessControl::className(),
* 'only' => ['create', 'update'], * 'only' => ['create', 'update'],
* 'rules' => [ * 'rules' => [
* // deny all POST requests * // deny all POST requests
...@@ -71,7 +73,7 @@ class AccessControl extends ActionFilter ...@@ -71,7 +73,7 @@ class AccessControl extends ActionFilter
* @var array the default configuration of access rules. Individual rule configurations * @var array the default configuration of access rules. Individual rule configurations
* specified via [[rules]] will take precedence when the same property of the rule is configured. * specified via [[rules]] will take precedence when the same property of the rule is configured.
*/ */
public $ruleConfig = ['class' => 'yii\web\AccessRule']; public $ruleConfig = ['class' => 'yii\filters\AccessRule'];
/** /**
* @var array a list of access rule objects or configuration arrays for creating the rule objects. * @var array a list of access rule objects or configuration arrays for creating the rule objects.
* If a rule is specified via a configuration array, it will be merged with [[ruleConfig]] first * If a rule is specified via a configuration array, it will be merged with [[ruleConfig]] first
......
...@@ -5,10 +5,13 @@ ...@@ -5,10 +5,13 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yii\web; namespace yii\filters;
use yii\base\Component; use yii\base\Component;
use yii\base\Action; use yii\base\Action;
use yii\web\User;
use yii\web\Request;
use yii\web\Controller;
/** /**
* This class represents an access rule defined by the [[AccessControl]] action filter * This class represents an access rule defined by the [[AccessControl]] action filter
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yii\web; namespace yii\filters;
use Yii; use Yii;
use yii\base\ActionFilter; use yii\base\ActionFilter;
...@@ -25,7 +25,7 @@ use yii\base\Action; ...@@ -25,7 +25,7 @@ use yii\base\Action;
* { * {
* return [ * return [
* 'httpCache' => [ * 'httpCache' => [
* 'class' => \yii\web\HttpCache::className(), * 'class' => \yii\filters\HttpCache::className(),
* 'only' => ['index'], * 'only' => ['index'],
* 'lastModified' => function ($action, $params) { * 'lastModified' => function ($action, $params) {
* $q = new \yii\db\Query(); * $q = new \yii\db\Query();
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yii\web; namespace yii\filters;
use Yii; use Yii;
use yii\base\ActionFilter; use yii\base\ActionFilter;
...@@ -28,7 +28,7 @@ use yii\caching\Dependency; ...@@ -28,7 +28,7 @@ use yii\caching\Dependency;
* { * {
* return [ * return [
* 'pageCache' => [ * 'pageCache' => [
* 'class' => \yii\web\PageCache::className(), * 'class' => \yii\filters\PageCache::className(),
* 'only' => ['list'], * 'only' => ['list'],
* 'duration' => 60, * 'duration' => 60,
* 'dependency' => [ * 'dependency' => [
......
...@@ -5,11 +5,14 @@ ...@@ -5,11 +5,14 @@
* @license http://www.yiiframework.com/license/ * @license http://www.yiiframework.com/license/
*/ */
namespace yii\web; namespace yii\filters;
use Yii; use Yii;
use yii\base\ActionEvent; use yii\base\ActionEvent;
use yii\base\Behavior; use yii\base\Behavior;
use yii\web\Controller;
use yii\web\HttpException;
use yii\web\MethodNotAllowedHttpException;
/** /**
* VerbFilter is an action filter that filters by HTTP request methods. * VerbFilter is an action filter that filters by HTTP request methods.
...@@ -26,7 +29,7 @@ use yii\base\Behavior; ...@@ -26,7 +29,7 @@ use yii\base\Behavior;
* { * {
* return [ * return [
* 'verbs' => [ * 'verbs' => [
* 'class' => \yii\web\VerbFilter::className(), * 'class' => \yii\filters\VerbFilter::className(),
* 'actions' => [ * 'actions' => [
* 'index' => ['get'], * 'index' => ['get'],
* 'view' => ['get'], * 'view' => ['get'],
......
...@@ -13,7 +13,7 @@ use yii\web\Response; ...@@ -13,7 +13,7 @@ use yii\web\Response;
use yii\web\UnauthorizedHttpException; use yii\web\UnauthorizedHttpException;
use yii\web\UnsupportedMediaTypeHttpException; use yii\web\UnsupportedMediaTypeHttpException;
use yii\web\TooManyRequestsHttpException; use yii\web\TooManyRequestsHttpException;
use yii\web\VerbFilter; use yii\filters\VerbFilter;
use yii\web\ForbiddenHttpException; use yii\web\ForbiddenHttpException;
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment