Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
48e67e8b
Commit
48e67e8b
authored
Apr 05, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed `PrefixUrlRule` to `GroupUrlRule`
parent
02c3c37a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
16 deletions
+14
-16
CHANGELOG.md
framework/CHANGELOG.md
+1
-1
ActionFilter.php
framework/base/ActionFilter.php
+1
-1
classes.php
framework/classes.php
+1
-1
CompositeUrlRule.php
framework/web/CompositeUrlRule.php
+1
-3
GroupUrlRule.php
framework/web/GroupUrlRule.php
+6
-6
GroupUrlRuleTest.php
tests/unit/framework/web/GroupUrlRuleTest.php
+4
-4
No files found.
framework/CHANGELOG.md
View file @
48e67e8b
...
@@ -287,7 +287,7 @@ Yii Framework 2 Change Log
...
@@ -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 #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: Yii framework now comes with core messages in multiple languages
-
New: Added
`yii\codeception\DbTestCase`
(qiangxue)
-
New: Added
`yii\codeception\DbTestCase`
(qiangxue)
-
New: Added
`yii\web\
Prefix
UrlRule`
(qiangxue)
-
New: Added
`yii\web\
Group
UrlRule`
(qiangxue)
2.
0.0-alpha, December 1, 2013
2.
0.0-alpha, December 1, 2013
-----------------------------
-----------------------------
...
...
framework/base/ActionFilter.php
View file @
48e67e8b
...
@@ -27,7 +27,7 @@ class ActionFilter extends Behavior
...
@@ -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)
* Note that if the filter is attached to a module, the action IDs should also include child module IDs (if any)
* and controller IDs.
* and controller IDs.
*
*
* @see except
* @see except
*/
*/
public
$only
;
public
$only
;
...
...
framework/classes.php
View file @
48e67e8b
...
@@ -258,7 +258,7 @@ return [
...
@@ -258,7 +258,7 @@ return [
'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\filters\PageCache'
=>
YII_PATH
.
'/filters/PageCache.php'
,
'yii\filters\PageCache'
=>
YII_PATH
.
'/filters/PageCache.php'
,
'yii\web\
PrefixUrlRule'
=>
YII_PATH
.
'/web/Prefix
UrlRule.php'
,
'yii\web\
GroupUrlRule'
=>
YII_PATH
.
'/web/Group
UrlRule.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'
,
'yii\web\Response'
=>
YII_PATH
.
'/web/Response.php'
,
'yii\web\Response'
=>
YII_PATH
.
'/web/Response.php'
,
...
...
framework/web/CompositeUrlRule.php
View file @
48e67e8b
...
@@ -11,9 +11,7 @@ use Yii;
...
@@ -11,9 +11,7 @@ use Yii;
use
yii\base\Object
;
use
yii\base\Object
;
/**
/**
* CompositeUrlRule represents a collection of related URL rules.
* CompositeUrlRule is the base class for URL rule classes that consist of multiple simpler rules.
*
* These URL rules are typically created for a common purpose (e.g. RESTful API for a resource).
*
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
...
...
framework/web/
Prefix
UrlRule.php
→
framework/web/
Group
UrlRule.php
View file @
48e67e8b
...
@@ -11,13 +11,13 @@ use Yii;
...
@@ -11,13 +11,13 @@ use Yii;
use
yii\base\InvalidConfigException
;
use
yii\base\InvalidConfigException
;
/**
/**
*
Prefix
UrlRule represents a collection of URL rules sharing the same prefix in their patterns and routes.
*
Group
UrlRule represents a collection of URL rules sharing the same prefix in their patterns and routes.
*
*
*
Prefix
UrlRule is best used by a module which often uses module ID as the prefix for the URL rules.
*
Group
UrlRule 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:
* For example, the following code creates a rule for the `admin` module:
*
*
* ```php
* ```php
* new
Prefix
UrlRule([
* new
Group
UrlRule([
* 'prefix' => 'admin',
* 'prefix' => 'admin',
* 'rules' => [
* 'rules' => [
* 'login' => 'user/login',
* 'login' => 'user/login',
...
@@ -38,14 +38,14 @@ use yii\base\InvalidConfigException;
...
@@ -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
* The above example assumes the prefix for patterns and routes are the same. They can be made different
* by configuring [[prefix]] and [[routePrefix]] separately.
* by configuring [[prefix]] and [[routePrefix]] separately.
*
*
* Using a
PrefixUrlRule is more efficient than directly declaring the individual rules its
contains.
* Using a
GroupUrlRule is more efficient than directly declaring the individual rules it
contains.
* This is because
Prefix
UrlRule can quickly determine if it should process a URL parsing or creation request
* This is because
Group
UrlRule can quickly determine if it should process a URL parsing or creation request
* by simply checking if the prefix matches.
* by simply checking if the prefix matches.
*
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
Prefix
UrlRule
extends
CompositeUrlRule
class
Group
UrlRule
extends
CompositeUrlRule
{
{
/**
/**
* @var array the rules contained within this composite rule. Please refer to [[UrlManager::rules]]
* @var array the rules contained within this composite rule. Please refer to [[UrlManager::rules]]
...
...
tests/unit/framework/web/
Prefix
UrlRuleTest.php
→
tests/unit/framework/web/
Group
UrlRuleTest.php
View file @
48e67e8b
...
@@ -4,14 +4,14 @@ namespace yiiunit\framework\web;
...
@@ -4,14 +4,14 @@ namespace yiiunit\framework\web;
use
yii\web\UrlManager
;
use
yii\web\UrlManager
;
use
yii\web\UrlRule
;
use
yii\web\UrlRule
;
use
yii\web\
Prefix
UrlRule
;
use
yii\web\
Group
UrlRule
;
use
yii\web\Request
;
use
yii\web\Request
;
use
yiiunit\TestCase
;
use
yiiunit\TestCase
;
/**
/**
* @group web
* @group web
*/
*/
class
Prefix
UrlRuleTest
extends
TestCase
class
Group
UrlRuleTest
extends
TestCase
{
{
protected
function
setUp
()
protected
function
setUp
()
{
{
...
@@ -25,7 +25,7 @@ class PrefixUrlRuleTest extends TestCase
...
@@ -25,7 +25,7 @@ class PrefixUrlRuleTest extends TestCase
$suites
=
$this
->
getTestsForCreateUrl
();
$suites
=
$this
->
getTestsForCreateUrl
();
foreach
(
$suites
as
$i
=>
$suite
)
{
foreach
(
$suites
as
$i
=>
$suite
)
{
list
(
$name
,
$config
,
$tests
)
=
$suite
;
list
(
$name
,
$config
,
$tests
)
=
$suite
;
$rule
=
new
Prefix
UrlRule
(
$config
);
$rule
=
new
Group
UrlRule
(
$config
);
foreach
(
$tests
as
$j
=>
$test
)
{
foreach
(
$tests
as
$j
=>
$test
)
{
list
(
$route
,
$params
,
$expected
)
=
$test
;
list
(
$route
,
$params
,
$expected
)
=
$test
;
$url
=
$rule
->
createUrl
(
$manager
,
$route
,
$params
);
$url
=
$rule
->
createUrl
(
$manager
,
$route
,
$params
);
...
@@ -41,7 +41,7 @@ class PrefixUrlRuleTest extends TestCase
...
@@ -41,7 +41,7 @@ class PrefixUrlRuleTest extends TestCase
$suites
=
$this
->
getTestsForParseRequest
();
$suites
=
$this
->
getTestsForParseRequest
();
foreach
(
$suites
as
$i
=>
$suite
)
{
foreach
(
$suites
as
$i
=>
$suite
)
{
list
(
$name
,
$config
,
$tests
)
=
$suite
;
list
(
$name
,
$config
,
$tests
)
=
$suite
;
$rule
=
new
Prefix
UrlRule
(
$config
);
$rule
=
new
Group
UrlRule
(
$config
);
foreach
(
$tests
as
$j
=>
$test
)
{
foreach
(
$tests
as
$j
=>
$test
)
{
$request
->
pathInfo
=
$test
[
0
];
$request
->
pathInfo
=
$test
[
0
];
$route
=
$test
[
1
];
$route
=
$test
[
1
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment