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
769a114d
Commit
769a114d
authored
Mar 10, 2012
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed groupBy and orderBy to be group and order.
parent
d794a813
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
110 additions
and
100 deletions
+110
-100
ActiveFinder.php
framework/db/ar/ActiveFinder.php
+34
-14
ActiveRecord.php
framework/db/ar/ActiveRecord.php
+4
-4
ActiveRelation.php
framework/db/ar/ActiveRelation.php
+8
-1
JoinElement.php
framework/db/ar/JoinElement.php
+8
-16
BaseQuery.php
framework/db/dao/BaseQuery.php
+27
-27
QueryBuilder.php
framework/db/dao/QueryBuilder.php
+4
-4
Customer.php
tests/unit/data/ar/Customer.php
+1
-1
ActiveRecordTest.php
tests/unit/framework/db/ar/ActiveRecordTest.php
+9
-5
CommandTest.php
tests/unit/framework/db/dao/CommandTest.php
+0
-13
QueryTest.php
tests/unit/framework/db/dao/QueryTest.php
+15
-15
No files found.
framework/db/ar/ActiveFinder.php
View file @
769a114d
...
...
@@ -103,6 +103,7 @@ class ActiveFinder extends \yii\base\Object
private
$_joinCount
;
private
$_tableAliases
;
private
$_hasMany
;
/**
* @param ActiveQuery $query
...
...
@@ -112,6 +113,7 @@ class ActiveFinder extends \yii\base\Object
{
$this
->
_joinCount
=
0
;
$this
->
_tableAliases
=
array
();
$this
->
_hasMany
=
false
;
$joinTree
=
new
JoinElement
(
$this
->
_joinCount
++
,
$query
,
null
,
null
);
$this
->
buildJoinTree
(
$joinTree
,
$query
->
with
);
$this
->
initJoinTree
(
$joinTree
);
...
...
@@ -123,7 +125,15 @@ class ActiveFinder extends \yii\base\Object
$joinTree
->
createRecord
(
$row
);
}
return
$query
->
indexBy
!==
null
?
$joinTree
->
records
:
array_values
(
$joinTree
->
records
);
if
(
$query
->
indexBy
!==
null
)
{
$records
=
array
();
foreach
(
$joinTree
->
records
as
$record
)
{
$records
[
$record
[
$query
->
indexBy
]]
=
$record
;
}
return
$records
;
}
else
{
return
array_values
(
$joinTree
->
records
);
}
}
protected
function
applyScopes
(
$query
)
...
...
@@ -182,7 +192,8 @@ class ActiveFinder extends \yii\base\Object
throw
new
Exception
(
"
$modelClass
has no relation named '
$with
'."
);
}
$relation
=
clone
$relations
[
$with
];
if
(
$relation
->
via
!==
null
&&
isset
(
$relations
[
$relation
->
via
]))
{
if
(
is_string
(
$relation
->
via
)
&&
isset
(
$relations
[
$relation
->
via
]))
{
// join via an existing relation
$parent2
=
$this
->
buildJoinTree
(
$parent
,
$relation
->
via
);
$relation
->
via
=
null
;
if
(
$parent2
->
joinOnly
===
null
)
{
...
...
@@ -213,6 +224,14 @@ class ActiveFinder extends \yii\base\Object
}
else
{
$alias
=
't'
;
}
if
(
$element
->
query
instanceof
ActiveRelation
)
{
if
(
$element
->
query
->
hasMany
)
{
$this
->
_hasMany
=
true
;
}
if
(
$element
->
parent
->
query
->
asArray
!==
null
&&
$element
->
query
->
asArray
===
null
)
{
$element
->
query
->
asArray
=
$element
->
parent
->
query
->
asArray
;
}
}
$count
=
0
;
while
(
isset
(
$this
->
_tableAliases
[
$alias
]))
{
$alias
=
't'
.
$count
++
;
...
...
@@ -279,8 +298,9 @@ class ActiveFinder extends \yii\base\Object
}
if
(
$element
->
query
instanceof
ActiveRelation
)
{
if
(
$element
->
query
->
via
!==
null
)
{
$query
->
join
[]
=
strtr
(
$element
->
query
->
via
,
$quotedPrefixes
);
if
(
is_array
(
$element
->
query
->
via
))
{
// todo: join via a pivot table
// $query->join[] = strtr($element->query->via, $quotedPrefixes);
}
if
(
$element
->
query
->
joinType
===
null
)
{
...
...
@@ -311,21 +331,21 @@ class ActiveFinder extends \yii\base\Object
}
}
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
);
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
);
}
foreach
(
$element
->
query
->
order
By
as
$orderBy
)
{
$query
->
order
By
[]
=
strtr
(
$orderBy
,
$prefixes
);
foreach
(
$element
->
query
->
order
as
$order
)
{
$query
->
order
[]
=
strtr
(
$order
,
$prefixes
);
}
}
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
);
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
);
}
foreach
(
$element
->
query
->
group
By
as
$groupBy
)
{
$query
->
group
By
[]
=
strtr
(
$groupBy
,
$prefixes
);
foreach
(
$element
->
query
->
group
as
$group
)
{
$query
->
group
[]
=
strtr
(
$group
,
$prefixes
);
}
}
...
...
framework/db/ar/ActiveRecord.php
View file @
769a114d
...
...
@@ -80,12 +80,12 @@ abstract class ActiveRecord extends Model
* // find all active customers and order them by their age:
* $customers = Customer::find()
* ->where(array('status' => 1))
* ->order
By
('age')
* ->order('age')
* ->all();
* // or alternatively:
* $customers = Customer::find(array(
* 'where' => array('status' => 1),
* 'order
By
' => 'age',
* 'order' => 'age',
* ))->all();
* ~~~
*
...
...
@@ -114,7 +114,7 @@ abstract class ActiveRecord extends Model
/**
* Creates an [[ActiveQuery]] instance and query by a given SQL statement.
* Note that because the SQL statement is already specified, calling further
* query methods (such as `where()`, `order
By
()`) on [[ActiveQuery]] will have no effect.
* query methods (such as `where()`, `order()`) on [[ActiveQuery]] will have no effect.
* Methods such as `with()`, `asArray()` can still be called though.
* @param string $sql the SQL statement to be executed
* @param array $params parameters to be bound to the SQL statement during execution.
...
...
@@ -267,7 +267,7 @@ abstract class ActiveRecord extends Model
* 'manager:Manager' => '@.id = ?.manager_id',
* 'assignments:Assignment[]' => array(
* 'on' => '@.owner_id = ?.id AND @.status = 1',
* 'order
By
' => '@.create_time DESC',
* 'order' => '@.create_time DESC',
* ),
* 'projects:Project[]' => array(
* 'via' => 'assignments',
...
...
framework/db/ar/ActiveRelation.php
View file @
769a114d
...
...
@@ -23,6 +23,13 @@ class ActiveRelation extends BaseActiveQuery
*/
public
$name
;
/**
* @var array the columns of the primary and foreign tables that establish the relation.
* The array keys must be columns of the table for this relation, and the array values
* must be the corresponding columns from the primary table. Do not prefix or quote the column names.
* They will be done automatically by Yii.
*/
public
$link
;
/**
* @var boolean whether this relation is a one-many relation
*/
public
$hasMany
;
...
...
@@ -36,7 +43,7 @@ class ActiveRelation extends BaseActiveQuery
*/
public
$on
;
/**
* @var string
* @var string
|array
*/
public
$via
;
}
framework/db/ar/JoinElement.php
View file @
769a114d
...
...
@@ -71,26 +71,18 @@ class JoinElement extends \yii\base\Object
*/
public
function
createRecord
(
$row
)
{
if
(
$this
->
query
->
indexBy
===
null
)
{
$pk
=
array
();
foreach
(
$this
->
pkAlias
as
$alias
)
{
if
(
isset
(
$row
[
$alias
]))
{
$pk
[]
=
$row
[
$alias
];
}
else
{
return
null
;
}
}
$pk
=
count
(
$pk
)
===
1
?
$pk
[
0
]
:
serialize
(
$pk
);
}
else
{
$pk
=
array_search
(
$this
->
query
->
indexBy
,
$this
->
columnAliases
);
if
(
$pk
!==
false
)
{
$pk
=
$row
[
$pk
];
$pk
=
array
();
foreach
(
$this
->
pkAlias
as
$alias
)
{
if
(
isset
(
$row
[
$alias
]))
{
$pk
[]
=
$row
[
$alias
];
}
else
{
throw
new
Exception
(
"Invalid indexBy:
{
$this
->
query
->
modelClass
}
has no attribute named '
{
$this
->
query
->
indexBy
}
'."
)
;
return
null
;
}
}
$pk
=
count
(
$pk
)
===
1
?
$pk
[
0
]
:
serialize
(
$pk
);
// create record
// todo: asArray
if
(
isset
(
$this
->
records
[
$pk
]))
{
$record
=
$this
->
records
[
$pk
];
}
else
{
...
...
@@ -120,7 +112,7 @@ class JoinElement extends \yii\base\Object
}
if
(
$child
->
query
->
hasMany
)
{
if
(
$child
->
query
->
indexBy
!==
null
)
{
$hash
=
$childRecord
->
{
$child
->
query
->
indexBy
}
;
$hash
=
$childRecord
[
$child
->
query
->
indexBy
]
;
}
else
{
$hash
=
serialize
(
$childRecord
->
getPrimaryKey
());
}
...
...
framework/db/dao/BaseQuery.php
View file @
769a114d
...
...
@@ -60,12 +60,12 @@ class BaseQuery extends \yii\base\Object
* @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
By
;
public
$order
;
/**
* @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
By
;
public
$group
;
/**
* @var string|array how to join with other tables. This refers to the JOIN clause in a SQL statement.
* It can either a string (e.g. `'LEFT JOIN tbl_user ON tbl_user.id=author_id'`) or an array (e.g.
...
...
@@ -329,11 +329,11 @@ class BaseQuery extends \yii\base\Object
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @return BaseQuery the query object itself
* @see addGroup
By
()
* @see addGroup()
*/
public
function
group
By
(
$columns
)
public
function
group
(
$columns
)
{
$this
->
group
By
=
$columns
;
$this
->
group
=
$columns
;
return
$this
;
}
...
...
@@ -344,20 +344,20 @@ class BaseQuery extends \yii\base\Object
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @return BaseQuery the query object itself
* @see group
By
()
* @see group()
*/
public
function
addGroup
By
(
$columns
)
public
function
addGroup
(
$columns
)
{
if
(
empty
(
$this
->
group
By
))
{
$this
->
group
By
=
$columns
;
if
(
empty
(
$this
->
group
))
{
$this
->
group
=
$columns
;
}
else
{
if
(
!
is_array
(
$this
->
group
By
))
{
$this
->
group
By
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$this
->
groupBy
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
if
(
!
is_array
(
$this
->
group
))
{
$this
->
group
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$this
->
group
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
if
(
!
is_array
(
$columns
))
{
$columns
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$columns
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
$this
->
group
By
=
array_merge
(
$this
->
groupBy
,
$columns
);
$this
->
group
=
array_merge
(
$this
->
group
,
$columns
);
}
return
$this
;
}
...
...
@@ -427,11 +427,11 @@ class BaseQuery extends \yii\base\Object
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @return BaseQuery the query object itself
* @see addOrder
By
()
* @see addOrder()
*/
public
function
order
By
(
$columns
)
public
function
order
(
$columns
)
{
$this
->
order
By
=
$columns
;
$this
->
order
=
$columns
;
return
$this
;
}
...
...
@@ -442,20 +442,20 @@ class BaseQuery extends \yii\base\Object
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* @return BaseQuery the query object itself
* @see order
By
()
* @see order()
*/
public
function
addOrder
By
(
$columns
)
public
function
addOrder
(
$columns
)
{
if
(
empty
(
$this
->
order
By
))
{
$this
->
order
By
=
$columns
;
if
(
empty
(
$this
->
order
))
{
$this
->
order
=
$columns
;
}
else
{
if
(
!
is_array
(
$this
->
order
By
))
{
$this
->
order
By
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$this
->
orderBy
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
if
(
!
is_array
(
$this
->
order
))
{
$this
->
order
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$this
->
order
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
if
(
!
is_array
(
$columns
))
{
$columns
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$columns
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
$this
->
order
By
=
array_merge
(
$this
->
orderBy
,
$columns
);
$this
->
order
=
array_merge
(
$this
->
order
,
$columns
);
}
return
$this
;
}
...
...
@@ -541,7 +541,7 @@ class BaseQuery extends \yii\base\Object
* takes precedence over this query.
* - [[where]], [[having]]: the new query's corresponding property value
* will be 'AND' together with the existing one.
* - [[params]], [[order
By]], [[groupBy
]], [[join]], [[union]]: the new query's
* - [[params]], [[order
]], [[group
]], [[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.
...
...
@@ -592,12 +592,12 @@ class BaseQuery extends \yii\base\Object
$this
->
addParams
(
$query
->
params
);
}
if
(
$query
->
order
By
!==
null
)
{
$this
->
addOrder
By
(
$query
->
orderBy
);
if
(
$query
->
order
!==
null
)
{
$this
->
addOrder
(
$query
->
order
);
}
if
(
$query
->
group
By
!==
null
)
{
$this
->
addGroup
By
(
$query
->
groupBy
);
if
(
$query
->
group
!==
null
)
{
$this
->
addGroup
(
$query
->
group
);
}
if
(
$query
->
join
!==
null
)
{
...
...
framework/db/dao/QueryBuilder.php
View file @
769a114d
...
...
@@ -68,10 +68,10 @@ class QueryBuilder extends \yii\base\Object
$this
->
buildFrom
(
$query
->
from
),
$this
->
buildJoin
(
$query
->
join
),
$this
->
buildWhere
(
$query
->
where
),
$this
->
buildGroup
By
(
$query
->
groupBy
),
$this
->
buildGroup
(
$query
->
group
),
$this
->
buildHaving
(
$query
->
having
),
$this
->
buildUnion
(
$query
->
union
),
$this
->
buildOrder
By
(
$query
->
orderBy
),
$this
->
buildOrder
(
$query
->
order
),
$this
->
buildLimit
(
$query
->
limit
,
$query
->
offset
),
);
return
implode
(
$this
->
separator
,
array_filter
(
$clauses
));
...
...
@@ -756,7 +756,7 @@ class QueryBuilder extends \yii\base\Object
* @param string|array $columns
* @return string the GROUP BY clause
*/
public
function
buildGroup
By
(
$columns
)
public
function
buildGroup
(
$columns
)
{
if
(
empty
(
$columns
))
{
return
''
;
...
...
@@ -779,7 +779,7 @@ class QueryBuilder extends \yii\base\Object
* @param string|array $columns
* @return string the ORDER BY clause built from [[query]].
*/
public
function
buildOrder
By
(
$columns
)
public
function
buildOrder
(
$columns
)
{
if
(
empty
(
$columns
))
{
return
''
;
...
...
tests/unit/data/ar/Customer.php
View file @
769a114d
...
...
@@ -25,7 +25,7 @@ class Customer extends ActiveRecord
{
return
array
(
'active'
=>
function
(
$q
)
{
return
$q
->
andWhere
(
'@.status =
1'
);
return
$q
->
andWhere
(
'@.status =
'
.
self
::
STATUS_ACTIVE
);
},
);
}
...
...
tests/unit/framework/db/ar/ActiveRecordTest.php
View file @
769a114d
...
...
@@ -200,7 +200,7 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertEquals
(
'user3'
,
$customer
->
name
);
$customer
=
Customer
::
find
()
->
select
(
'id'
)
->
order
By
(
'id DESC'
)
->
one
();
$customer
=
Customer
::
find
()
->
select
(
'id'
)
->
order
(
'id DESC'
)
->
one
();
$this
->
assertTrue
(
$customer
instanceof
Customer
);
$this
->
assertEquals
(
3
,
$customer
->
id
);
$this
->
assertEquals
(
null
,
$customer
->
name
);
...
...
@@ -214,23 +214,27 @@ class ActiveRecordTest extends \yiiunit\MysqlTestCase
$this
->
assertEquals
(
2
,
count
(
$customers
));
// asArray
$customers
=
Customer
::
find
()
->
order
By
(
'id'
)
->
asArray
()
->
all
();
$customers
=
Customer
::
find
()
->
order
(
'id'
)
->
asArray
()
->
all
();
$this
->
assertEquals
(
'user2'
,
$customers
[
1
][
'name'
]);
// indexBy
$customers
=
Customer
::
find
()
->
order
By
(
'id'
)
->
indexBy
(
'name'
)
->
all
();
$customers
=
Customer
::
find
()
->
order
(
'id'
)
->
indexBy
(
'name'
)
->
all
();
$this
->
assertEquals
(
2
,
$customers
[
'user2'
][
'id'
]);
}
public
function
testEagerLoading
()
{
$customers
=
Customer
::
find
()
->
with
(
'orders'
)
->
order
By
(
'@.id'
)
->
all
();
$customers
=
Customer
::
find
()
->
with
(
'orders'
)
->
order
(
'@.id'
)
->
all
();
$this
->
assertEquals
(
3
,
count
(
$customers
));
$this
->
assertEquals
(
1
,
count
(
$customers
[
0
]
->
orders
));
$this
->
assertEquals
(
2
,
count
(
$customers
[
1
]
->
orders
));
$this
->
assertEquals
(
0
,
count
(
$customers
[
2
]
->
orders
));
$customers
=
Customer
::
find
()
->
with
(
'orders.customer'
)
->
orderBy
(
'@.id'
)
->
all
();
$customers
=
Customer
::
find
()
->
with
(
'orders.customer'
)
->
order
(
'@.id'
)
->
all
();
$this
->
assertEquals
(
3
,
count
(
$customers
));
$this
->
assertEquals
(
1
,
$customers
[
0
]
->
orders
[
0
]
->
customer
->
id
);
$this
->
assertEquals
(
2
,
$customers
[
1
]
->
orders
[
0
]
->
customer
->
id
);
$this
->
assertEquals
(
2
,
$customers
[
1
]
->
orders
[
1
]
->
customer
->
id
);
}
/*
...
...
tests/unit/framework/db/dao/CommandTest.php
View file @
769a114d
...
...
@@ -21,19 +21,6 @@ class CommandTest extends \yiiunit\MysqlTestCase
$sql
=
'SELECT * FROM tbl_customer'
;
$command
=
$db
->
createCommand
(
$sql
);
$this
->
assertEquals
(
$sql
,
$command
->
sql
);
// Query object
$query
=
new
Query
;
$query
->
select
(
'id'
)
->
from
(
'tbl_customer'
);
$command
=
$db
->
createCommand
(
$query
);
$this
->
assertEquals
(
"SELECT `id` FROM `tbl_customer`"
,
$command
->
sql
);
// array
$command
=
$db
->
createCommand
(
array
(
'select'
=>
'name'
,
'from'
=>
'tbl_customer'
,
));
$this
->
assertEquals
(
"SELECT `name` FROM `tbl_customer`"
,
$command
->
sql
);
}
function
testGetSetSql
()
...
...
tests/unit/framework/db/dao/QueryTest.php
View file @
769a114d
...
...
@@ -13,7 +13,7 @@ class QueryTest extends \yiiunit\MysqlTestCase
{
// default
$query
=
new
Query
;
$query
->
select
();
$query
->
select
(
'*'
);
$this
->
assertEquals
(
'*'
,
$query
->
select
);
$this
->
assertNull
(
$query
->
distinct
);
$this
->
assertEquals
(
null
,
$query
->
selectOption
);
...
...
@@ -53,17 +53,17 @@ class QueryTest extends \yiiunit\MysqlTestCase
}
function
testGroup
By
()
function
testGroup
()
{
$query
=
new
Query
;
$query
->
group
By
(
'team'
);
$this
->
assertEquals
(
'team'
,
$query
->
group
By
);
$query
->
group
(
'team'
);
$this
->
assertEquals
(
'team'
,
$query
->
group
);
$query
->
addGroup
By
(
'company'
);
$this
->
assertEquals
(
array
(
'team'
,
'company'
),
$query
->
group
By
);
$query
->
addGroup
(
'company'
);
$this
->
assertEquals
(
array
(
'team'
,
'company'
),
$query
->
group
);
$query
->
addGroup
By
(
'age'
);
$this
->
assertEquals
(
array
(
'team'
,
'company'
,
'age'
),
$query
->
group
By
);
$query
->
addGroup
(
'age'
);
$this
->
assertEquals
(
array
(
'team'
,
'company'
,
'age'
),
$query
->
group
);
}
function
testHaving
()
...
...
@@ -82,17 +82,17 @@ class QueryTest extends \yiiunit\MysqlTestCase
$this
->
assertEquals
(
array
(
':id'
=>
1
,
':name'
=>
'something'
,
':age'
=>
'30'
),
$query
->
params
);
}
function
testOrder
By
()
function
testOrder
()
{
$query
=
new
Query
;
$query
->
order
By
(
'team'
);
$this
->
assertEquals
(
'team'
,
$query
->
order
By
);
$query
->
order
(
'team'
);
$this
->
assertEquals
(
'team'
,
$query
->
order
);
$query
->
addOrder
By
(
'company'
);
$this
->
assertEquals
(
array
(
'team'
,
'company'
),
$query
->
order
By
);
$query
->
addOrder
(
'company'
);
$this
->
assertEquals
(
array
(
'team'
,
'company'
),
$query
->
order
);
$query
->
addOrder
By
(
'age'
);
$this
->
assertEquals
(
array
(
'team'
,
'company'
,
'age'
),
$query
->
order
By
);
$query
->
addOrder
(
'age'
);
$this
->
assertEquals
(
array
(
'team'
,
'company'
,
'age'
),
$query
->
order
);
}
function
testLimitOffset
()
...
...
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