Commit 48e67e8b by Qiang Xue

renamed `PrefixUrlRule` to `GroupUrlRule`

parent 02c3c37a
......@@ -287,7 +287,7 @@ Yii Framework 2 Change Log
- New #2932: Added `yii\web\ViewAction` that allow you to render views based on GET parameter (samdark)
- New: Yii framework now comes with core messages in multiple languages
- New: Added `yii\codeception\DbTestCase` (qiangxue)
- New: Added `yii\web\PrefixUrlRule` (qiangxue)
- New: Added `yii\web\GroupUrlRule` (qiangxue)
2.0.0-alpha, December 1, 2013
-----------------------------
......
......@@ -27,7 +27,7 @@ class ActionFilter extends Behavior
*
* Note that if the filter is attached to a module, the action IDs should also include child module IDs (if any)
* and controller IDs.
*
*
* @see except
*/
public $only;
......
......@@ -258,7 +258,7 @@ return [
'yii\web\NotAcceptableHttpException' => YII_PATH . '/web/NotAcceptableHttpException.php',
'yii\web\NotFoundHttpException' => YII_PATH . '/web/NotFoundHttpException.php',
'yii\filters\PageCache' => YII_PATH . '/filters/PageCache.php',
'yii\web\PrefixUrlRule' => YII_PATH . '/web/PrefixUrlRule.php',
'yii\web\GroupUrlRule' => YII_PATH . '/web/GroupUrlRule.php',
'yii\web\Request' => YII_PATH . '/web/Request.php',
'yii\web\RequestParserInterface' => YII_PATH . '/web/RequestParserInterface.php',
'yii\web\Response' => YII_PATH . '/web/Response.php',
......
......@@ -11,9 +11,7 @@ use Yii;
use yii\base\Object;
/**
* CompositeUrlRule represents a collection of related URL rules.
*
* These URL rules are typically created for a common purpose (e.g. RESTful API for a resource).
* CompositeUrlRule is the base class for URL rule classes that consist of multiple simpler rules.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
......
......@@ -11,13 +11,13 @@ use Yii;
use yii\base\InvalidConfigException;
/**
* PrefixUrlRule represents a collection of URL rules sharing the same prefix in their patterns and routes.
* GroupUrlRule represents a collection of URL rules sharing the same prefix in their patterns and routes.
*
* PrefixUrlRule is best used by a module which often uses module ID as the prefix for the URL rules.
* GroupUrlRule is best used by a module which often uses module ID as the prefix for the URL rules.
* For example, the following code creates a rule for the `admin` module:
*
* ```php
* new PrefixUrlRule([
* new GroupUrlRule([
* 'prefix' => 'admin',
* 'rules' => [
* 'login' => 'user/login',
......@@ -38,14 +38,14 @@ use yii\base\InvalidConfigException;
* The above example assumes the prefix for patterns and routes are the same. They can be made different
* by configuring [[prefix]] and [[routePrefix]] separately.
*
* Using a PrefixUrlRule is more efficient than directly declaring the individual rules its contains.
* This is because PrefixUrlRule can quickly determine if it should process a URL parsing or creation request
* Using a GroupUrlRule is more efficient than directly declaring the individual rules it contains.
* This is because GroupUrlRule can quickly determine if it should process a URL parsing or creation request
* by simply checking if the prefix matches.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class PrefixUrlRule extends CompositeUrlRule
class GroupUrlRule extends CompositeUrlRule
{
/**
* @var array the rules contained within this composite rule. Please refer to [[UrlManager::rules]]
......
......@@ -4,14 +4,14 @@ namespace yiiunit\framework\web;
use yii\web\UrlManager;
use yii\web\UrlRule;
use yii\web\PrefixUrlRule;
use yii\web\GroupUrlRule;
use yii\web\Request;
use yiiunit\TestCase;
/**
* @group web
*/
class PrefixUrlRuleTest extends TestCase
class GroupUrlRuleTest extends TestCase
{
protected function setUp()
{
......@@ -25,7 +25,7 @@ class PrefixUrlRuleTest extends TestCase
$suites = $this->getTestsForCreateUrl();
foreach ($suites as $i => $suite) {
list ($name, $config, $tests) = $suite;
$rule = new PrefixUrlRule($config);
$rule = new GroupUrlRule($config);
foreach ($tests as $j => $test) {
list ($route, $params, $expected) = $test;
$url = $rule->createUrl($manager, $route, $params);
......@@ -41,7 +41,7 @@ class PrefixUrlRuleTest extends TestCase
$suites = $this->getTestsForParseRequest();
foreach ($suites as $i => $suite) {
list ($name, $config, $tests) = $suite;
$rule = new PrefixUrlRule($config);
$rule = new GroupUrlRule($config);
foreach ($tests as $j => $test) {
$request->pathInfo = $test[0];
$route = $test[1];
......
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