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
1b7c00a0
Commit
1b7c00a0
authored
Jan 28, 2012
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
86ae5bdf
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
105 additions
and
59 deletions
+105
-59
YiiBase.php
framework/YiiBase.php
+13
-9
Component.php
framework/base/Component.php
+20
-7
Object.php
framework/base/Object.php
+3
-4
ActiveQuery.php
framework/db/ar/ActiveQuery.php
+27
-9
BaseQuery.php
framework/db/dao/BaseQuery.php
+38
-29
Query.php
framework/db/dao/Query.php
+1
-1
upgrade.md
upgrade.md
+3
-0
No files found.
framework/YiiBase.php
View file @
1b7c00a0
...
@@ -76,16 +76,16 @@ class YiiBase
...
@@ -76,16 +76,16 @@ class YiiBase
/**
/**
* @var array initial property values that will be applied to objects newly created via [[createObject]].
* @var array initial property values that will be applied to objects newly created via [[createObject]].
* The array keys are fully qualified namespaced class names, and the array values are the corresponding
* The array keys are fully qualified namespaced class names, and the array values are the corresponding
* name-value pairs for initializing the created class instances.
Make sure the class names do NOT have
* name-value pairs for initializing the created class instances.
Please make sure class names are starting
*
the leading backslashes
. For example,
*
with a backslash
. For example,
*
*
* ~~~
* ~~~
* array(
* array(
* '
mycompany\foo
\Bar' => array(
* '\Bar' => array(
* 'prop1' => 'value1',
* 'prop1' => 'value1',
* 'prop2' => 'value2',
* 'prop2' => 'value2',
* ),
* ),
* 'mycompany\foo\Car' => array(
* '
\
mycompany\foo\Car' => array(
* 'prop1' => 'value1',
* 'prop1' => 'value1',
* 'prop2' => 'value2',
* 'prop2' => 'value2',
* ),
* ),
...
@@ -301,6 +301,9 @@ class YiiBase
...
@@ -301,6 +301,9 @@ class YiiBase
/**
/**
* Creates a new object using the given configuration.
* Creates a new object using the given configuration.
*
*
* The class of the object can be any class. It does not have to
* extend from [[Object]] or [[Component]].
*
* The configuration can be either a string or an array.
* The configuration can be either a string or an array.
* If a string, it is treated as the *object type*; if an array,
* If a string, it is treated as the *object type*; if an array,
* it must contain a `class` element specifying the *object type*, and
* it must contain a `class` element specifying the *object type*, and
...
@@ -310,7 +313,7 @@ class YiiBase
...
@@ -310,7 +313,7 @@ class YiiBase
* The object type can be either a class name or the [[getAlias|alias]] of
* The object type can be either a class name or the [[getAlias|alias]] of
* the class. For example,
* the class. For example,
*
*
* - `\app\components\GoogleMap`:
namespaced class
* - `\app\components\GoogleMap`:
full qualified namespaced class.
* - `@app/components/GoogleMap`: an alias
* - `@app/components/GoogleMap`: an alias
*
*
* This method does the following steps to create an object:
* This method does the following steps to create an object:
...
@@ -319,7 +322,7 @@ class YiiBase
...
@@ -319,7 +322,7 @@ class YiiBase
* - if [[objectConfig]] contains the configuration for the object class,
* - if [[objectConfig]] contains the configuration for the object class,
* it will be merged with the configuration passed to this method;
* it will be merged with the configuration passed to this method;
* - initialize the object properties using the configuration passed to this method;
* - initialize the object properties using the configuration passed to this method;
* - call the `init` method of the object if it implements the [[yii\base\Initable]] interface.
* - call the `init` method of the object if it implements the [[
\
yii\base\Initable]] interface.
*
*
* Below are some usage examples:
* Below are some usage examples:
*
*
...
@@ -337,6 +340,7 @@ class YiiBase
...
@@ -337,6 +340,7 @@ class YiiBase
* @param mixed $config the configuration. It can be either a string or an array.
* @param mixed $config the configuration. It can be either a string or an array.
* @return mixed the created object
* @return mixed the created object
* @throws \yii\base\Exception if the configuration is invalid.
* @throws \yii\base\Exception if the configuration is invalid.
* @see \yii\base\Object::newInstance()
*/
*/
public
static
function
createObject
(
$config
)
public
static
function
createObject
(
$config
)
{
{
...
@@ -372,9 +376,9 @@ class YiiBase
...
@@ -372,9 +376,9 @@ class YiiBase
$object
=
$r
->
newInstanceArgs
(
$args
);
$object
=
$r
->
newInstanceArgs
(
$args
);
}
}
$c
=
get_class
(
$object
);
$c
lass
=
'\\'
.
get_class
(
$object
);
if
(
isset
(
\Yii
::
$objectConfig
[
$c
]))
{
if
(
isset
(
\Yii
::
$objectConfig
[
$c
lass
]))
{
$config
=
array_merge
(
\Yii
::
$objectConfig
[
$c
],
$config
);
$config
=
array_merge
(
\Yii
::
$objectConfig
[
$c
lass
],
$config
);
}
}
foreach
(
$config
as
$name
=>
$value
)
{
foreach
(
$config
as
$name
=>
$value
)
{
...
...
framework/base/Component.php
View file @
1b7c00a0
...
@@ -461,11 +461,8 @@ class Component extends Object
...
@@ -461,11 +461,8 @@ class Component extends Object
*/
*/
public
function
attachBehavior
(
$name
,
$behavior
)
public
function
attachBehavior
(
$name
,
$behavior
)
{
{
if
(
!
(
$behavior
instanceof
Behavior
))
{
$this
->
ensureBehaviors
();
$behavior
=
\Yii
::
createObject
(
$behavior
);
return
$this
->
attachBehaviorInternal
(
$name
,
$behavior
);
}
$behavior
->
attach
(
$this
);
return
$this
->
_b
[
$name
]
=
$behavior
;
}
}
/**
/**
...
@@ -478,8 +475,9 @@ class Component extends Object
...
@@ -478,8 +475,9 @@ class Component extends Object
*/
*/
public
function
attachBehaviors
(
$behaviors
)
public
function
attachBehaviors
(
$behaviors
)
{
{
$this
->
ensureBehaviors
();
foreach
(
$behaviors
as
$name
=>
$behavior
)
{
foreach
(
$behaviors
as
$name
=>
$behavior
)
{
$this
->
attachBehavior
(
$name
,
$behavior
);
$this
->
attachBehavior
Internal
(
$name
,
$behavior
);
}
}
}
}
...
@@ -523,8 +521,23 @@ class Component extends Object
...
@@ -523,8 +521,23 @@ class Component extends Object
if
(
$this
->
_b
===
null
)
{
if
(
$this
->
_b
===
null
)
{
$this
->
_b
=
array
();
$this
->
_b
=
array
();
foreach
(
$this
->
behaviors
()
as
$name
=>
$behavior
)
{
foreach
(
$this
->
behaviors
()
as
$name
=>
$behavior
)
{
$this
->
attachBehavior
(
$name
,
$behavior
);
$this
->
attachBehavior
Internal
(
$name
,
$behavior
);
}
}
}
}
}
}
/**
* Attaches a behavior to this component.
* @param string $name the name of the behavior.
* @param string|array|Behavior $behavior the behavior to be attached
* @return Behavior the attached behavior.
*/
private
function
attachBehaviorInternal
(
$name
,
$behavior
)
{
if
(
!
(
$behavior
instanceof
Behavior
))
{
$behavior
=
\Yii
::
createObject
(
$behavior
);
}
$behavior
->
attach
(
$this
);
return
$this
->
_b
[
$name
]
=
$behavior
;
}
}
}
framework/base/Object.php
View file @
1b7c00a0
...
@@ -300,8 +300,7 @@ class Object
...
@@ -300,8 +300,7 @@ class Object
*/
*/
public
static
function
newInstance
(
$config
=
array
())
public
static
function
newInstance
(
$config
=
array
())
{
{
$c
=
get_called_class
();
$class
=
'\\'
.
get_called_class
();
$class
=
'\\'
.
$c
;
if
((
$n
=
func_num_args
()
-
1
)
>
0
)
{
if
((
$n
=
func_num_args
()
-
1
)
>
0
)
{
$args
=
func_get_args
();
$args
=
func_get_args
();
...
@@ -321,8 +320,8 @@ class Object
...
@@ -321,8 +320,8 @@ class Object
$object
=
$r
->
newInstanceArgs
(
$args
);
$object
=
$r
->
newInstanceArgs
(
$args
);
}
}
if
(
isset
(
\Yii
::
$objectConfig
[
$c
]))
{
if
(
isset
(
\Yii
::
$objectConfig
[
$c
lass
]))
{
$config
=
array_merge
(
\Yii
::
$objectConfig
[
$c
],
$config
);
$config
=
array_merge
(
\Yii
::
$objectConfig
[
$c
lass
],
$config
);
}
}
foreach
(
$config
as
$name
=>
$value
)
{
foreach
(
$config
as
$name
=>
$value
)
{
...
...
framework/db/ar/ActiveQuery.php
View file @
1b7c00a0
...
@@ -10,6 +10,9 @@
...
@@ -10,6 +10,9 @@
namespace
yii\db\ar
;
namespace
yii\db\ar
;
use
yii\db\dao\BaseQuery
;
use
yii\base\VectorIterator
;
/**
/**
* ActiveFinder.php is ...
* ActiveFinder.php is ...
* todo: add SQL monitor
* todo: add SQL monitor
...
@@ -17,18 +20,18 @@ namespace yii\db\ar;
...
@@ -17,18 +20,18 @@ namespace yii\db\ar;
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
class
ActiveQuery
extends
\yii\db\dao\
BaseQuery
implements
\IteratorAggregate
,
\ArrayAccess
,
\Countable
class
ActiveQuery
extends
BaseQuery
implements
\IteratorAggregate
,
\ArrayAccess
,
\Countable
{
{
public
$modelClass
;
public
$modelClass
;
public
$with
;
public
$with
;
public
$alias
;
public
$alias
;
public
$index
;
public
$indexBy
;
public
$asArray
;
private
$_count
;
private
$_count
;
private
$_sql
;
private
$_sql
;
private
$_countSql
;
private
$_countSql
;
private
$_asArray
;
private
$_records
;
private
$_records
;
public
function
all
()
public
function
all
()
...
@@ -51,7 +54,26 @@ class ActiveQuery extends \yii\db\dao\BaseQuery implements \IteratorAggregate, \
...
@@ -51,7 +54,26 @@ class ActiveQuery extends \yii\db\dao\BaseQuery implements \IteratorAggregate, \
public
function
asArray
(
$value
=
true
)
public
function
asArray
(
$value
=
true
)
{
{
$this
->
_asArray
=
$value
;
$this
->
asArray
=
$value
;
return
$this
;
}
public
function
with
()
{
$this
->
with
=
func_get_args
();
return
$this
;
}
public
function
indexBy
(
$column
)
{
$this
->
indexBy
=
$column
;
return
$this
;
}
public
function
alias
(
$tableAlias
)
{
$this
->
alias
=
$tableAlias
;
return
$this
;
}
}
protected
function
performQuery
()
protected
function
performQuery
()
...
@@ -74,10 +96,6 @@ class ActiveQuery extends \yii\db\dao\BaseQuery implements \IteratorAggregate, \
...
@@ -74,10 +96,6 @@ class ActiveQuery extends \yii\db\dao\BaseQuery implements \IteratorAggregate, \
return
$records
;
return
$records
;
}
}
public
function
with
()
{
}
//
//
// public function getSql($connection = null)
// public function getSql($connection = null)
// {
// {
...
@@ -150,7 +168,7 @@ class ActiveQuery extends \yii\db\dao\BaseQuery implements \IteratorAggregate, \
...
@@ -150,7 +168,7 @@ class ActiveQuery extends \yii\db\dao\BaseQuery implements \IteratorAggregate, \
public
function
getIterator
()
public
function
getIterator
()
{
{
$records
=
$this
->
performQuery
();
$records
=
$this
->
performQuery
();
return
new
\yii\base\
VectorIterator
(
$records
);
return
new
VectorIterator
(
$records
);
}
}
/**
/**
...
...
framework/db/dao/BaseQuery.php
View file @
1b7c00a0
...
@@ -11,12 +11,12 @@
...
@@ -11,12 +11,12 @@
namespace
yii\db\dao
;
namespace
yii\db\dao
;
/**
/**
* Query represents a SQL statement in a way that is independent of DBMS.
*
Base
Query represents a SQL statement in a way that is independent of DBMS.
*
*
* Query not only can represent a SELECT statement, it can also represent INSERT, UPDATE, DELETE,
*
Base
Query not only can represent a SELECT statement, it can also represent INSERT, UPDATE, DELETE,
* and other commonly used DDL statements, such as CREATE TABLE, CREATE INDEX, etc.
* and other commonly used DDL statements, such as CREATE TABLE, CREATE INDEX, etc.
*
*
* Query provides a set of methods to facilitate the specification of different clauses.
*
Base
Query provides a set of methods to facilitate the specification of different clauses.
* These methods can be chained together. For example,
* These methods can be chained together. For example,
*
*
* ~~~
* ~~~
...
@@ -120,27 +120,36 @@ class BaseQuery extends \yii\base\Object
...
@@ -120,27 +120,36 @@ class BaseQuery extends \yii\base\Object
* Columns can contain table prefixes (e.g. "tbl_user.id") and/or column aliases (e.g. "tbl_user.id AS user_id").
* Columns can contain table prefixes (e.g. "tbl_user.id") and/or column aliases (e.g. "tbl_user.id AS user_id").
* The method will automatically quote the column names unless a column contains some parenthesis
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* (which means the column contains a DB expression).
* @param boolean $distinct whether to use 'SELECT DISTINCT'.
* @param string $option additional option that should be appended to the 'SELECT' keyword. For example,
* @param string $option additional option that should be appended to the 'SELECT' keyword. For example,
* in MySQL, the option 'SQL_CALC_FOUND_ROWS' can be used.
* in MySQL, the option 'SQL_CALC_FOUND_ROWS' can be used.
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
select
(
$columns
=
'*'
,
$
distinct
=
false
,
$
option
=
''
)
public
function
select
(
$columns
=
'*'
,
$option
=
''
)
{
{
$this
->
select
=
$columns
;
$this
->
select
=
$columns
;
$this
->
distinct
=
$distinct
;
$this
->
selectOption
=
$option
;
$this
->
selectOption
=
$option
;
return
$this
;
return
$this
;
}
}
/**
/**
* Sets the value indicating whether to SELECT DISTINCT or not.
* @param bool $value whether to SELECT DISTINCT or not.
* @return BaseQuery the query object itself
*/
public
function
distinct
(
$value
=
true
)
{
$this
->
distinct
=
$value
;
return
$this
;
}
/**
* Sets the FROM part of the query.
* Sets the FROM part of the query.
* @param mixed $tables the table(s) to be selected from. This can be either a string (e.g. 'tbl_user')
* @param mixed $tables the table(s) to be selected from. This can be either a string (e.g. 'tbl_user')
* or an array (e.g. array('tbl_user', 'tbl_profile')) specifying one or several table names.
* or an array (e.g. array('tbl_user', 'tbl_profile')) specifying one or several table names.
* Table names can contain schema prefixes (e.g. 'public.tbl_user') and/or table aliases (e.g. 'tbl_user u').
* Table names can contain schema prefixes (e.g. 'public.tbl_user') and/or table aliases (e.g. 'tbl_user u').
* The method will automatically quote the table names unless it contains some parenthesis
* The method will automatically quote the table names unless it contains some parenthesis
* (which means the table is given as a sub-query or DB expression).
* (which means the table is given as a sub-query or DB expression).
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
from
(
$tables
)
public
function
from
(
$tables
)
{
{
...
@@ -215,7 +224,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -215,7 +224,7 @@ class BaseQuery extends \yii\base\Object
* @param array $params the parameters (name=>value) to be bound to the query.
* @param array $params the parameters (name=>value) to be bound to the query.
* For anonymous parameters, they can alternatively be specified as separate parameters to this method.
* For anonymous parameters, they can alternatively be specified as separate parameters to this method.
* For example, `where('type=? AND status=?', 100, 1)`.
* For example, `where('type=? AND status=?', 100, 1)`.
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see andWhere()
* @see andWhere()
* @see orWhere()
* @see orWhere()
*/
*/
...
@@ -237,7 +246,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -237,7 +246,7 @@ class BaseQuery extends \yii\base\Object
* on how to specify this parameter.
* on how to specify this parameter.
* @param array $params the parameters (name=>value) to be bound to the query.
* @param array $params the parameters (name=>value) to be bound to the query.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see where()
* @see where()
* @see orWhere()
* @see orWhere()
*/
*/
...
@@ -263,7 +272,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -263,7 +272,7 @@ class BaseQuery extends \yii\base\Object
* on how to specify this parameter.
* on how to specify this parameter.
* @param array $params the parameters (name=>value) to be bound to the query.
* @param array $params the parameters (name=>value) to be bound to the query.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see where()
* @see where()
* @see andWhere()
* @see andWhere()
*/
*/
...
@@ -292,7 +301,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -292,7 +301,7 @@ class BaseQuery extends \yii\base\Object
* Please refer to [[where()]] on how to specify this parameter.
* Please refer to [[where()]] on how to specify this parameter.
* @param array $params the parameters (name=>value) to be bound to the query.
* @param array $params the parameters (name=>value) to be bound to the query.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
join
(
$table
,
$condition
,
$params
=
array
())
public
function
join
(
$table
,
$condition
,
$params
=
array
())
{
{
...
@@ -314,7 +323,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -314,7 +323,7 @@ class BaseQuery extends \yii\base\Object
* @param string|array $condition the join condition that should appear in the ON part.
* @param string|array $condition the join condition that should appear in the ON part.
* Please refer to [[where()]] on how to specify this parameter.
* Please refer to [[where()]] on how to specify this parameter.
* @param array $params the parameters (name=>value) to be bound to the query
* @param array $params the parameters (name=>value) to be bound to the query
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
leftJoin
(
$table
,
$condition
,
$params
=
array
())
public
function
leftJoin
(
$table
,
$condition
,
$params
=
array
())
{
{
...
@@ -336,7 +345,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -336,7 +345,7 @@ class BaseQuery extends \yii\base\Object
* @param string|array $condition the join condition that should appear in the ON part.
* @param string|array $condition the join condition that should appear in the ON part.
* Please refer to [[where()]] on how to specify this parameter.
* Please refer to [[where()]] on how to specify this parameter.
* @param array $params the parameters (name=>value) to be bound to the query
* @param array $params the parameters (name=>value) to be bound to the query
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
rightJoin
(
$table
,
$condition
,
$params
=
array
())
public
function
rightJoin
(
$table
,
$condition
,
$params
=
array
())
{
{
...
@@ -356,7 +365,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -356,7 +365,7 @@ class BaseQuery extends \yii\base\Object
* Table name can contain schema prefix (e.g. 'public.tbl_user') and/or table alias (e.g. 'tbl_user u').
* Table name can contain schema prefix (e.g. 'public.tbl_user') and/or table alias (e.g. 'tbl_user u').
* The method will automatically quote the table name unless it contains some parenthesis
* The method will automatically quote the table name unless it contains some parenthesis
* (which means the table is given as a sub-query or DB expression).
* (which means the table is given as a sub-query or DB expression).
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
crossJoin
(
$table
)
public
function
crossJoin
(
$table
)
{
{
...
@@ -371,7 +380,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -371,7 +380,7 @@ class BaseQuery extends \yii\base\Object
* Table name can contain schema prefix (e.g. 'public.tbl_user') and/or table alias (e.g. 'tbl_user u').
* Table name can contain schema prefix (e.g. 'public.tbl_user') and/or table alias (e.g. 'tbl_user u').
* The method will automatically quote the table name unless it contains some parenthesis
* The method will automatically quote the table name unless it contains some parenthesis
* (which means the table is given as a sub-query or DB expression).
* (which means the table is given as a sub-query or DB expression).
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
naturalJoin
(
$table
)
public
function
naturalJoin
(
$table
)
{
{
...
@@ -385,7 +394,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -385,7 +394,7 @@ class BaseQuery extends \yii\base\Object
* Columns can be specified in either a string (e.g. "id, name") or an array (e.g. array('id', 'name')).
* Columns can be specified in either a string (e.g. "id, name") or an array (e.g. array('id', 'name')).
* The method will automatically quote the column names unless a column contains some parenthesis
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* (which means the column contains a DB expression).
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see addGroupBy()
* @see addGroupBy()
*/
*/
public
function
groupBy
(
$columns
)
public
function
groupBy
(
$columns
)
...
@@ -400,7 +409,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -400,7 +409,7 @@ class BaseQuery extends \yii\base\Object
* Columns can be specified in either a string (e.g. "id, name") or an array (e.g. array('id', 'name')).
* Columns can be specified in either a string (e.g. "id, name") or an array (e.g. array('id', 'name')).
* The method will automatically quote the column names unless a column contains some parenthesis
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* (which means the column contains a DB expression).
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see groupBy()
* @see groupBy()
*/
*/
public
function
addGroupBy
(
$columns
)
public
function
addGroupBy
(
$columns
)
...
@@ -425,7 +434,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -425,7 +434,7 @@ class BaseQuery extends \yii\base\Object
* Please refer to [[where()]] on how to specify this parameter.
* Please refer to [[where()]] on how to specify this parameter.
* @param array $params the parameters (name=>value) to be bound to the query.
* @param array $params the parameters (name=>value) to be bound to the query.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see andHaving()
* @see andHaving()
* @see orHaving()
* @see orHaving()
*/
*/
...
@@ -447,7 +456,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -447,7 +456,7 @@ class BaseQuery extends \yii\base\Object
* on how to specify this parameter.
* on how to specify this parameter.
* @param array $params the parameters (name=>value) to be bound to the query.
* @param array $params the parameters (name=>value) to be bound to the query.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see having()
* @see having()
* @see orHaving()
* @see orHaving()
*/
*/
...
@@ -473,7 +482,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -473,7 +482,7 @@ class BaseQuery extends \yii\base\Object
* on how to specify this parameter.
* on how to specify this parameter.
* @param array $params the parameters (name=>value) to be bound to the query.
* @param array $params the parameters (name=>value) to be bound to the query.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see having()
* @see having()
* @see andHaving()
* @see andHaving()
*/
*/
...
@@ -498,7 +507,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -498,7 +507,7 @@ class BaseQuery extends \yii\base\Object
* Columns can be specified in either a string (e.g. "id ASC, name DESC") or an array (e.g. array('id ASC', 'name DESC')).
* Columns can be specified in either a string (e.g. "id ASC, name DESC") or an array (e.g. array('id ASC', 'name DESC')).
* The method will automatically quote the column names unless a column contains some parenthesis
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* (which means the column contains a DB expression).
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see addOrderBy()
* @see addOrderBy()
*/
*/
public
function
orderBy
(
$columns
)
public
function
orderBy
(
$columns
)
...
@@ -513,7 +522,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -513,7 +522,7 @@ class BaseQuery extends \yii\base\Object
* Columns can be specified in either a string (e.g. "id ASC, name DESC") or an array (e.g. array('id ASC', 'name DESC')).
* Columns can be specified in either a string (e.g. "id ASC, name DESC") or an array (e.g. array('id ASC', 'name DESC')).
* The method will automatically quote the column names unless a column contains some parenthesis
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
* (which means the column contains a DB expression).
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see orderBy()
* @see orderBy()
*/
*/
public
function
addOrderBy
(
$columns
)
public
function
addOrderBy
(
$columns
)
...
@@ -535,7 +544,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -535,7 +544,7 @@ class BaseQuery extends \yii\base\Object
/**
/**
* Sets the LIMIT part of the query.
* Sets the LIMIT part of the query.
* @param integer $limit the limit
* @param integer $limit the limit
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
limit
(
$limit
)
public
function
limit
(
$limit
)
{
{
...
@@ -546,7 +555,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -546,7 +555,7 @@ class BaseQuery extends \yii\base\Object
/**
/**
* Sets the OFFSET part of the query.
* Sets the OFFSET part of the query.
* @param integer $offset the offset
* @param integer $offset the offset
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
offset
(
$offset
)
public
function
offset
(
$offset
)
{
{
...
@@ -557,7 +566,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -557,7 +566,7 @@ class BaseQuery extends \yii\base\Object
/**
/**
* Appends a SQL statement using UNION operator.
* Appends a SQL statement using UNION operator.
* @param string $sql the SQL statement to be appended using UNION
* @param string $sql the SQL statement to be appended using UNION
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
union
(
$sql
)
public
function
union
(
$sql
)
{
{
...
@@ -570,7 +579,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -570,7 +579,7 @@ class BaseQuery extends \yii\base\Object
* @param array list of query parameter values indexed by parameter placeholders.
* @param array list of query parameter values indexed by parameter placeholders.
* For example, `array(':name'=>'Dan', ':age'=>31)`.
* For example, `array(':name'=>'Dan', ':age'=>31)`.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see addParams()
* @see addParams()
*/
*/
public
function
params
(
$params
)
public
function
params
(
$params
)
...
@@ -584,7 +593,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -584,7 +593,7 @@ class BaseQuery extends \yii\base\Object
* @param array list of query parameter values indexed by parameter placeholders.
* @param array list of query parameter values indexed by parameter placeholders.
* For example, `array(':name'=>'Dan', ':age'=>31)`.
* For example, `array(':name'=>'Dan', ':age'=>31)`.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* Please refer to [[where()]] on alternative syntax of specifying anonymous parameters.
* @return Query the query object itself
* @return
Base
Query the query object itself
* @see params()
* @see params()
*/
*/
public
function
addParams
(
$params
)
public
function
addParams
(
$params
)
...
@@ -703,7 +712,7 @@ class BaseQuery extends \yii\base\Object
...
@@ -703,7 +712,7 @@ class BaseQuery extends \yii\base\Object
/**
/**
* Resets the query object to its original state.
* Resets the query object to its original state.
* @return Query the query object itself
* @return
Base
Query the query object itself
*/
*/
public
function
reset
()
public
function
reset
()
{
{
...
...
framework/db/dao/Query.php
View file @
1b7c00a0
...
@@ -43,7 +43,7 @@ class Query extends BaseQuery
...
@@ -43,7 +43,7 @@ class Query extends BaseQuery
{
{
/**
/**
* @var array the operation that this query represents. This refers to the method call as well as
* @var array the operation that this query represents. This refers to the method call as well as
* the corresponding parameters for constructing a non-
query
SQL statement (e.g. INSERT, CREATE TABLE).
* the corresponding parameters for constructing a non-
select
SQL statement (e.g. INSERT, CREATE TABLE).
* This property is mainly maintained by methods such as [[insert()]], [[update()]], [[createTable()]].
* This property is mainly maintained by methods such as [[insert()]], [[update()]], [[createTable()]].
* If this property is not set, it means this query represents a SELECT statement.
* If this property is not set, it means this query represents a SELECT statement.
*/
*/
...
...
upgrade.md
View file @
1b7c00a0
...
@@ -31,6 +31,9 @@ Upgrading from v1.1.x
...
@@ -31,6 +31,9 @@ Upgrading from v1.1.x
-
The root alias
`@yii`
now represents the framework installation directory.
-
The root alias
`@yii`
now represents the framework installation directory.
In 1.x, this is named as
`system`
. We also removed
`zii`
root alias.
In 1.x, this is named as
`system`
. We also removed
`zii`
root alias.
-
Object serves as the base class that supports properties. And Component extends
from Object and supports events and behaviors. Behaviors declared in
Component::behaviors() are attached on demand.
-
`CList`
is renamed to
`Vector`
, and
`CMap`
is renamed to
`Dictionary`
.
-
`CList`
is renamed to
`Vector`
, and
`CMap`
is renamed to
`Dictionary`
.
Other collection classes are dropped in favor of SPL classes.
Other collection classes are dropped in favor of SPL classes.
...
...
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