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
794df816
Commit
794df816
authored
Nov 12, 2012
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed order and group to orderBy and groupBy
parent
e828cc66
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
34 deletions
+34
-34
ActiveFinder.php
framework/db/ar/ActiveFinder.php
+10
-10
ActiveRecord.php
framework/db/ar/ActiveRecord.php
+0
-0
BaseQuery.php
framework/db/dao/BaseQuery.php
+22
-22
QueryBuilder.php
framework/db/dao/QueryBuilder.php
+2
-2
No files found.
framework/db/ar/ActiveFinder.php
View file @
794df816
...
...
@@ -467,21 +467,21 @@ class ActiveFinder extends \yii\base\Object
}
}
if
(
$element
->
query
->
order
!==
null
)
{
if
(
!
is_array
(
$element
->
query
->
order
))
{
$element
->
query
->
order
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$element
->
query
->
order
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
if
(
$element
->
query
->
order
By
!==
null
)
{
if
(
!
is_array
(
$element
->
query
->
order
By
))
{
$element
->
query
->
order
By
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$element
->
query
->
orderBy
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
foreach
(
$element
->
query
->
order
as
$order
)
{
$query
->
order
[]
=
strtr
(
$order
,
$prefixes
);
foreach
(
$element
->
query
->
order
By
as
$order
)
{
$query
->
order
By
[]
=
strtr
(
$order
,
$prefixes
);
}
}
if
(
$element
->
query
->
group
!==
null
)
{
if
(
!
is_array
(
$element
->
query
->
group
))
{
$element
->
query
->
group
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$element
->
query
->
group
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
if
(
$element
->
query
->
group
By
!==
null
)
{
if
(
!
is_array
(
$element
->
query
->
group
By
))
{
$element
->
query
->
group
By
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$element
->
query
->
groupBy
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
foreach
(
$element
->
query
->
group
as
$group
)
{
$query
->
group
[]
=
strtr
(
$group
,
$prefixes
);
foreach
(
$element
->
query
->
group
By
as
$group
)
{
$query
->
group
By
[]
=
strtr
(
$group
,
$prefixes
);
}
}
...
...
framework/db/ar/ActiveRecord.php
View file @
794df816
framework/db/dao/BaseQuery.php
View file @
794df816
...
...
@@ -59,12 +59,12 @@ class BaseQuery extends \yii\base\Component
* @var string|array how to sort the query results. This refers to the ORDER BY clause in a SQL statement.
* It can be either a string (e.g. `'id ASC, name DESC'`) or an array (e.g. `array('id ASC', 'name DESC')`).
*/
public
$order
;
public
$order
By
;
/**
* @var string|array how to group the query results. This refers to the GROUP BY clause in a SQL statement.
* It can be either a string (e.g. `'company, department'`) or an array (e.g. `array('company', 'department')`).
*/
public
$group
;
public
$group
By
;
/**
* @var string|array how to join with other tables. This refers to the JOIN clause in a SQL statement.
* It can be either a string (e.g. `'LEFT JOIN tbl_user ON tbl_user.id=author_id'`) or an array (e.g.
...
...
@@ -330,9 +330,9 @@ class BaseQuery extends \yii\base\Component
* @return BaseQuery the query object itself
* @see addGroup()
*/
public
function
group
(
$columns
)
public
function
group
By
(
$columns
)
{
$this
->
group
=
$columns
;
$this
->
group
By
=
$columns
;
return
$this
;
}
...
...
@@ -347,16 +347,16 @@ class BaseQuery extends \yii\base\Component
*/
public
function
addGroup
(
$columns
)
{
if
(
empty
(
$this
->
group
))
{
$this
->
group
=
$columns
;
if
(
empty
(
$this
->
group
By
))
{
$this
->
group
By
=
$columns
;
}
else
{
if
(
!
is_array
(
$this
->
group
))
{
$this
->
group
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$this
->
group
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
if
(
!
is_array
(
$this
->
group
By
))
{
$this
->
group
By
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$this
->
groupBy
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
if
(
!
is_array
(
$columns
))
{
$columns
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$columns
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
$this
->
group
=
array_merge
(
$this
->
group
,
$columns
);
$this
->
group
By
=
array_merge
(
$this
->
groupBy
,
$columns
);
}
return
$this
;
}
...
...
@@ -428,9 +428,9 @@ class BaseQuery extends \yii\base\Component
* @return BaseQuery the query object itself
* @see addOrder()
*/
public
function
order
(
$columns
)
public
function
order
By
(
$columns
)
{
$this
->
order
=
$columns
;
$this
->
order
By
=
$columns
;
return
$this
;
}
...
...
@@ -443,18 +443,18 @@ class BaseQuery extends \yii\base\Component
* @return BaseQuery the query object itself
* @see order()
*/
public
function
addOrder
(
$columns
)
public
function
addOrder
By
(
$columns
)
{
if
(
empty
(
$this
->
order
))
{
$this
->
order
=
$columns
;
if
(
empty
(
$this
->
order
By
))
{
$this
->
order
By
=
$columns
;
}
else
{
if
(
!
is_array
(
$this
->
order
))
{
$this
->
order
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$this
->
order
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
if
(
!
is_array
(
$this
->
order
By
))
{
$this
->
order
By
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$this
->
orderBy
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
if
(
!
is_array
(
$columns
))
{
$columns
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$columns
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
$this
->
order
=
array_merge
(
$this
->
order
,
$columns
);
$this
->
order
By
=
array_merge
(
$this
->
orderBy
,
$columns
);
}
return
$this
;
}
...
...
@@ -540,7 +540,7 @@ class BaseQuery extends \yii\base\Component
* takes precedence over this query.
* - [[where]], [[having]]: the new query's corresponding property value
* will be 'AND' together with the existing one.
* - [[params]], [[order
]], [[group
]], [[join]], [[union]]: the new query's
* - [[params]], [[order
By]], [[groupBy
]], [[join]], [[union]]: the new query's
* corresponding property value will be appended to the existing one.
*
* In general, the merging makes the resulting query more restrictive and specific.
...
...
@@ -591,12 +591,12 @@ class BaseQuery extends \yii\base\Component
$this
->
addParams
(
$query
->
params
);
}
if
(
$query
->
order
!==
null
)
{
$this
->
addOrder
(
$query
->
order
);
if
(
$query
->
order
By
!==
null
)
{
$this
->
addOrder
By
(
$query
->
orderBy
);
}
if
(
$query
->
group
!==
null
)
{
$this
->
addGroup
(
$query
->
group
);
if
(
$query
->
group
By
!==
null
)
{
$this
->
addGroup
(
$query
->
group
By
);
}
if
(
$query
->
join
!==
null
)
{
...
...
framework/db/dao/QueryBuilder.php
View file @
794df816
...
...
@@ -69,10 +69,10 @@ class QueryBuilder extends \yii\base\Object
$this
->
buildFrom
(
$query
->
from
),
$this
->
buildJoin
(
$query
->
join
),
$this
->
buildWhere
(
$query
->
where
),
$this
->
buildGroup
(
$query
->
group
),
$this
->
buildGroup
(
$query
->
group
By
),
$this
->
buildHaving
(
$query
->
having
),
$this
->
buildUnion
(
$query
->
union
),
$this
->
buildOrder
(
$query
->
order
),
$this
->
buildOrder
(
$query
->
order
By
),
$this
->
buildLimit
(
$query
->
limit
,
$query
->
offset
),
);
return
implode
(
$this
->
separator
,
array_filter
(
$clauses
));
...
...
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