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
76d8e2b5
Commit
76d8e2b5
authored
Apr 17, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code style, fixes #3140
parent
e5280470
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
19 additions
and
32 deletions
+19
-32
BaseYii.php
framework/BaseYii.php
+0
-0
ArrayAccessTrait.php
framework/base/ArrayAccessTrait.php
+2
-2
Formatter.php
framework/base/Formatter.php
+1
-0
FixtureController.php
framework/console/controllers/FixtureController.php
+1
-0
ActiveRelationTrait.php
framework/db/ActiveRelationTrait.php
+4
-1
BaseActiveRecord.php
framework/db/BaseActiveRecord.php
+1
-1
Query.php
framework/db/Query.php
+1
-20
QueryBuilder.php
framework/db/oci/QueryBuilder.php
+7
-7
Request.php
framework/web/Request.php
+2
-1
No files found.
framework/BaseYii.php
View file @
76d8e2b5
framework/base/ArrayAccessTrait.php
View file @
76d8e2b5
...
@@ -13,10 +13,10 @@ namespace yii\base;
...
@@ -13,10 +13,10 @@ namespace yii\base;
* Note that ArrayAccessTrait requires the class using it contain a property named `data` which should be an array.
* Note that ArrayAccessTrait requires the class using it contain a property named `data` which should be an array.
* The data will be exposed by ArrayAccessTrait to support accessing the class object like an array.
* The data will be exposed by ArrayAccessTrait to support accessing the class object like an array.
*
*
* @property array $data
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*
* @property array $data
*/
*/
trait
ArrayAccessTrait
trait
ArrayAccessTrait
{
{
...
...
framework/base/Formatter.php
View file @
76d8e2b5
...
@@ -350,6 +350,7 @@ class Formatter extends Component
...
@@ -350,6 +350,7 @@ class Formatter extends Component
if
(
is_string
(
$value
))
{
if
(
is_string
(
$value
))
{
return
is_numeric
(
$value
)
||
$value
===
''
?
(
int
)
$value
:
strtotime
(
$value
);
return
is_numeric
(
$value
)
||
$value
===
''
?
(
int
)
$value
:
strtotime
(
$value
);
}
elseif
(
$value
instanceof
DateTime
||
$value
instanceof
\DateTimeInterface
)
{
}
elseif
(
$value
instanceof
DateTime
||
$value
instanceof
\DateTimeInterface
)
{
/** @var $value \DateTimeInterface */
return
$value
->
getTimestamp
();
return
$value
->
getTimestamp
();
}
else
{
}
else
{
return
(
int
)
$value
;
return
(
int
)
$value
;
...
...
framework/console/controllers/FixtureController.php
View file @
76d8e2b5
...
@@ -118,6 +118,7 @@ class FixtureController extends Controller
...
@@ -118,6 +118,7 @@ class FixtureController extends Controller
* whitespace between names.
* whitespace between names.
* @param array|string $fixtures
* @param array|string $fixtures
* @param array|string $except
* @param array|string $except
* @throws \yii\console\Exception in case no fixtures are found.
*/
*/
public
function
actionUnload
(
array
$fixtures
,
array
$except
=
[])
public
function
actionUnload
(
array
$fixtures
,
array
$except
=
[])
{
{
...
...
framework/db/ActiveRelationTrait.php
View file @
76d8e2b5
...
@@ -257,7 +257,6 @@ trait ActiveRelationTrait
...
@@ -257,7 +257,6 @@ trait ActiveRelationTrait
* @param ActiveRecordInterface[] $models models
* @param ActiveRecordInterface[] $models models
* @param string $primaryName the primary relation name
* @param string $primaryName the primary relation name
* @param string $name the relation name
* @param string $name the relation name
* @return null
*/
*/
private
function
populateInverseRelation
(
&
$primaryModels
,
$models
,
$primaryName
,
$name
)
private
function
populateInverseRelation
(
&
$primaryModels
,
$models
,
$primaryName
,
$name
)
{
{
...
@@ -368,6 +367,10 @@ trait ActiveRelationTrait
...
@@ -368,6 +367,10 @@ trait ActiveRelationTrait
return
$buckets
;
return
$buckets
;
}
}
/**
* @param array $attributes the attributes to prefix
* @return array
*/
private
function
prefixKeyColumns
(
$attributes
)
private
function
prefixKeyColumns
(
$attributes
)
{
{
if
(
$this
instanceof
ActiveQuery
&&
(
!
empty
(
$this
->
join
)
||
!
empty
(
$this
->
joinWith
)))
{
if
(
$this
instanceof
ActiveQuery
&&
(
!
empty
(
$this
->
join
)
||
!
empty
(
$this
->
joinWith
)))
{
...
...
framework/db/BaseActiveRecord.php
View file @
76d8e2b5
...
@@ -911,7 +911,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
...
@@ -911,7 +911,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
*/
*/
public
function
refresh
()
public
function
refresh
()
{
{
/** @var
ActiveQuery
$record */
/** @var
BaseActiveRecord
$record */
$record
=
$this
->
findOne
(
$this
->
getPrimaryKey
(
true
));
$record
=
$this
->
findOne
(
$this
->
getPrimaryKey
(
true
));
if
(
$record
===
null
)
{
if
(
$record
===
null
)
{
return
false
;
return
false
;
...
...
framework/db/Query.php
View file @
76d8e2b5
...
@@ -107,6 +107,7 @@ class Query extends Component implements QueryInterface
...
@@ -107,6 +107,7 @@ class Query extends Component implements QueryInterface
*/
*/
public
$params
=
[];
public
$params
=
[];
/**
/**
* Creates a DB command that can be used to execute this query.
* Creates a DB command that can be used to execute this query.
* @param Connection $db the database connection used to generate the SQL statement.
* @param Connection $db the database connection used to generate the SQL statement.
...
@@ -201,7 +202,6 @@ class Query extends Component implements QueryInterface
...
@@ -201,7 +202,6 @@ class Query extends Component implements QueryInterface
public
function
all
(
$db
=
null
)
public
function
all
(
$db
=
null
)
{
{
$rows
=
$this
->
createCommand
(
$db
)
->
queryAll
();
$rows
=
$this
->
createCommand
(
$db
)
->
queryAll
();
return
$this
->
prepareResult
(
$rows
);
return
$this
->
prepareResult
(
$rows
);
}
}
...
@@ -226,7 +226,6 @@ class Query extends Component implements QueryInterface
...
@@ -226,7 +226,6 @@ class Query extends Component implements QueryInterface
}
}
$result
[
$key
]
=
$row
;
$result
[
$key
]
=
$row
;
}
}
return
$result
;
return
$result
;
}
}
...
@@ -343,7 +342,6 @@ class Query extends Component implements QueryInterface
...
@@ -343,7 +342,6 @@ class Query extends Component implements QueryInterface
$this
->
select
=
[
new
Expression
(
'1'
)];
$this
->
select
=
[
new
Expression
(
'1'
)];
$command
=
$this
->
createCommand
(
$db
);
$command
=
$this
->
createCommand
(
$db
);
$this
->
select
=
$select
;
$this
->
select
=
$select
;
return
$command
->
queryScalar
()
!==
false
;
return
$command
->
queryScalar
()
!==
false
;
}
}
...
@@ -404,7 +402,6 @@ class Query extends Component implements QueryInterface
...
@@ -404,7 +402,6 @@ class Query extends Component implements QueryInterface
}
}
$this
->
select
=
$columns
;
$this
->
select
=
$columns
;
$this
->
selectOption
=
$option
;
$this
->
selectOption
=
$option
;
return
$this
;
return
$this
;
}
}
...
@@ -424,7 +421,6 @@ class Query extends Component implements QueryInterface
...
@@ -424,7 +421,6 @@ class Query extends Component implements QueryInterface
}
else
{
}
else
{
$this
->
select
=
array_merge
(
$this
->
select
,
$columns
);
$this
->
select
=
array_merge
(
$this
->
select
,
$columns
);
}
}
return
$this
;
return
$this
;
}
}
...
@@ -436,7 +432,6 @@ class Query extends Component implements QueryInterface
...
@@ -436,7 +432,6 @@ class Query extends Component implements QueryInterface
public
function
distinct
(
$value
=
true
)
public
function
distinct
(
$value
=
true
)
{
{
$this
->
distinct
=
$value
;
$this
->
distinct
=
$value
;
return
$this
;
return
$this
;
}
}
...
@@ -462,7 +457,6 @@ class Query extends Component implements QueryInterface
...
@@ -462,7 +457,6 @@ class Query extends Component implements QueryInterface
$tables
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$tables
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
$tables
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$tables
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
}
$this
->
from
=
$tables
;
$this
->
from
=
$tables
;
return
$this
;
return
$this
;
}
}
...
@@ -570,7 +564,6 @@ class Query extends Component implements QueryInterface
...
@@ -570,7 +564,6 @@ class Query extends Component implements QueryInterface
$this
->
where
=
[
'and'
,
$this
->
where
,
$condition
];
$this
->
where
=
[
'and'
,
$this
->
where
,
$condition
];
}
}
$this
->
addParams
(
$params
);
$this
->
addParams
(
$params
);
return
$this
;
return
$this
;
}
}
...
@@ -618,7 +611,6 @@ class Query extends Component implements QueryInterface
...
@@ -618,7 +611,6 @@ class Query extends Component implements QueryInterface
public
function
join
(
$type
,
$table
,
$on
=
''
,
$params
=
[])
public
function
join
(
$type
,
$table
,
$on
=
''
,
$params
=
[])
{
{
$this
->
join
[]
=
[
$type
,
$table
,
$on
];
$this
->
join
[]
=
[
$type
,
$table
,
$on
];
return
$this
->
addParams
(
$params
);
return
$this
->
addParams
(
$params
);
}
}
...
@@ -643,7 +635,6 @@ class Query extends Component implements QueryInterface
...
@@ -643,7 +635,6 @@ class Query extends Component implements QueryInterface
public
function
innerJoin
(
$table
,
$on
=
''
,
$params
=
[])
public
function
innerJoin
(
$table
,
$on
=
''
,
$params
=
[])
{
{
$this
->
join
[]
=
[
'INNER JOIN'
,
$table
,
$on
];
$this
->
join
[]
=
[
'INNER JOIN'
,
$table
,
$on
];
return
$this
->
addParams
(
$params
);
return
$this
->
addParams
(
$params
);
}
}
...
@@ -668,7 +659,6 @@ class Query extends Component implements QueryInterface
...
@@ -668,7 +659,6 @@ class Query extends Component implements QueryInterface
public
function
leftJoin
(
$table
,
$on
=
''
,
$params
=
[])
public
function
leftJoin
(
$table
,
$on
=
''
,
$params
=
[])
{
{
$this
->
join
[]
=
[
'LEFT JOIN'
,
$table
,
$on
];
$this
->
join
[]
=
[
'LEFT JOIN'
,
$table
,
$on
];
return
$this
->
addParams
(
$params
);
return
$this
->
addParams
(
$params
);
}
}
...
@@ -693,7 +683,6 @@ class Query extends Component implements QueryInterface
...
@@ -693,7 +683,6 @@ class Query extends Component implements QueryInterface
public
function
rightJoin
(
$table
,
$on
=
''
,
$params
=
[])
public
function
rightJoin
(
$table
,
$on
=
''
,
$params
=
[])
{
{
$this
->
join
[]
=
[
'RIGHT JOIN'
,
$table
,
$on
];
$this
->
join
[]
=
[
'RIGHT JOIN'
,
$table
,
$on
];
return
$this
->
addParams
(
$params
);
return
$this
->
addParams
(
$params
);
}
}
...
@@ -712,7 +701,6 @@ class Query extends Component implements QueryInterface
...
@@ -712,7 +701,6 @@ class Query extends Component implements QueryInterface
$columns
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$columns
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
$columns
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$columns
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
}
$this
->
groupBy
=
$columns
;
$this
->
groupBy
=
$columns
;
return
$this
;
return
$this
;
}
}
...
@@ -735,7 +723,6 @@ class Query extends Component implements QueryInterface
...
@@ -735,7 +723,6 @@ class Query extends Component implements QueryInterface
}
else
{
}
else
{
$this
->
groupBy
=
array_merge
(
$this
->
groupBy
,
$columns
);
$this
->
groupBy
=
array_merge
(
$this
->
groupBy
,
$columns
);
}
}
return
$this
;
return
$this
;
}
}
...
@@ -752,7 +739,6 @@ class Query extends Component implements QueryInterface
...
@@ -752,7 +739,6 @@ class Query extends Component implements QueryInterface
{
{
$this
->
having
=
$condition
;
$this
->
having
=
$condition
;
$this
->
addParams
(
$params
);
$this
->
addParams
(
$params
);
return
$this
;
return
$this
;
}
}
...
@@ -774,7 +760,6 @@ class Query extends Component implements QueryInterface
...
@@ -774,7 +760,6 @@ class Query extends Component implements QueryInterface
$this
->
having
=
[
'and'
,
$this
->
having
,
$condition
];
$this
->
having
=
[
'and'
,
$this
->
having
,
$condition
];
}
}
$this
->
addParams
(
$params
);
$this
->
addParams
(
$params
);
return
$this
;
return
$this
;
}
}
...
@@ -796,7 +781,6 @@ class Query extends Component implements QueryInterface
...
@@ -796,7 +781,6 @@ class Query extends Component implements QueryInterface
$this
->
having
=
[
'or'
,
$this
->
having
,
$condition
];
$this
->
having
=
[
'or'
,
$this
->
having
,
$condition
];
}
}
$this
->
addParams
(
$params
);
$this
->
addParams
(
$params
);
return
$this
;
return
$this
;
}
}
...
@@ -809,7 +793,6 @@ class Query extends Component implements QueryInterface
...
@@ -809,7 +793,6 @@ class Query extends Component implements QueryInterface
public
function
union
(
$sql
,
$all
=
false
)
public
function
union
(
$sql
,
$all
=
false
)
{
{
$this
->
union
[]
=
[
'query'
=>
$sql
,
'all'
=>
$all
];
$this
->
union
[]
=
[
'query'
=>
$sql
,
'all'
=>
$all
];
return
$this
;
return
$this
;
}
}
...
@@ -823,7 +806,6 @@ class Query extends Component implements QueryInterface
...
@@ -823,7 +806,6 @@ class Query extends Component implements QueryInterface
public
function
params
(
$params
)
public
function
params
(
$params
)
{
{
$this
->
params
=
$params
;
$this
->
params
=
$params
;
return
$this
;
return
$this
;
}
}
...
@@ -849,7 +831,6 @@ class Query extends Component implements QueryInterface
...
@@ -849,7 +831,6 @@ class Query extends Component implements QueryInterface
}
}
}
}
}
}
return
$this
;
return
$this
;
}
}
}
}
framework/db/oci/QueryBuilder.php
View file @
76d8e2b5
...
@@ -17,7 +17,7 @@ use yii\base\InvalidParamException;
...
@@ -17,7 +17,7 @@ use yii\base\InvalidParamException;
*/
*/
class
QueryBuilder
extends
\yii\db\QueryBuilder
class
QueryBuilder
extends
\yii\db\QueryBuilder
{
{
private
$sql
;
private
$
_
sql
;
/**
/**
* @inheritdoc
* @inheritdoc
...
@@ -37,16 +37,16 @@ class QueryBuilder extends \yii\db\QueryBuilder
...
@@ -37,16 +37,16 @@ class QueryBuilder extends \yii\db\QueryBuilder
$this
->
buildHaving
(
$query
->
having
,
$params
),
$this
->
buildHaving
(
$query
->
having
,
$params
),
$this
->
buildOrderBy
(
$query
->
orderBy
),
$this
->
buildOrderBy
(
$query
->
orderBy
),
];
];
$this
->
sql
=
implode
(
$this
->
separator
,
array_filter
(
$clauses
));
$this
->
_
sql
=
implode
(
$this
->
separator
,
array_filter
(
$clauses
));
$this
->
sql
=
$this
->
buildLimit
(
$query
->
limit
,
$query
->
offset
);
$this
->
_
sql
=
$this
->
buildLimit
(
$query
->
limit
,
$query
->
offset
);
$union
=
$this
->
buildUnion
(
$query
->
union
,
$params
);
$union
=
$this
->
buildUnion
(
$query
->
union
,
$params
);
if
(
$union
!==
''
)
{
if
(
$union
!==
''
)
{
$this
->
sql
=
"
{
$this
->
sql
}{
$this
->
separator
}
$union
"
;
$this
->
_sql
=
"
{
$this
->
_
sql
}{
$this
->
separator
}
$union
"
;
}
}
return
[
$this
->
sql
,
$params
];
return
[
$this
->
_
sql
,
$params
];
}
}
public
function
buildLimit
(
$limit
,
$offset
)
public
function
buildLimit
(
$limit
,
$offset
)
...
@@ -64,14 +64,14 @@ class QueryBuilder extends \yii\db\QueryBuilder
...
@@ -64,14 +64,14 @@ class QueryBuilder extends \yii\db\QueryBuilder
$filter
=
implode
(
' and '
,
$filters
);
$filter
=
implode
(
' and '
,
$filters
);
return
<<<EOD
return
<<<EOD
WITH USER_SQL AS ({$this->sql}),
WITH USER_SQL AS ({$this->
_
sql}),
PAGINATION AS (SELECT USER_SQL.*, rownum as rowNumId FROM USER_SQL)
PAGINATION AS (SELECT USER_SQL.*, rownum as rowNumId FROM USER_SQL)
SELECT *
SELECT *
FROM PAGINATION
FROM PAGINATION
WHERE $filter
WHERE $filter
EOD;
EOD;
}
else
{
}
else
{
return
$this
->
sql
;
return
$this
->
_
sql
;
}
}
}
}
...
...
framework/web/Request.php
View file @
76d8e2b5
...
@@ -679,7 +679,8 @@ class Request extends \yii\base\Request
...
@@ -679,7 +679,8 @@ class Request extends \yii\base\Request
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs'
,
$pathInfo
))
{
)*$%xs'
,
$pathInfo
)
)
{
$pathInfo
=
utf8_encode
(
$pathInfo
);
$pathInfo
=
utf8_encode
(
$pathInfo
);
}
}
...
...
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