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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
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
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
42 deletions
+29
-42
BaseYii.php
framework/BaseYii.php
+1
-1
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
+5
-2
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
+10
-9
No files found.
framework/BaseYii.php
View file @
76d8e2b5
...
...
@@ -349,7 +349,7 @@ class BaseYii
}
private
static
$_logger
;
/**
* @return Logger message logger
*/
...
...
framework/base/ArrayAccessTrait.php
View file @
76d8e2b5
...
...
@@ -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.
* 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>
* @since 2.0
*
* @property array $data
*/
trait
ArrayAccessTrait
{
...
...
framework/base/Formatter.php
View file @
76d8e2b5
...
...
@@ -350,6 +350,7 @@ class Formatter extends Component
if
(
is_string
(
$value
))
{
return
is_numeric
(
$value
)
||
$value
===
''
?
(
int
)
$value
:
strtotime
(
$value
);
}
elseif
(
$value
instanceof
DateTime
||
$value
instanceof
\DateTimeInterface
)
{
/** @var $value \DateTimeInterface */
return
$value
->
getTimestamp
();
}
else
{
return
(
int
)
$value
;
...
...
framework/console/controllers/FixtureController.php
View file @
76d8e2b5
...
...
@@ -118,6 +118,7 @@ class FixtureController extends Controller
* whitespace between names.
* @param array|string $fixtures
* @param array|string $except
* @throws \yii\console\Exception in case no fixtures are found.
*/
public
function
actionUnload
(
array
$fixtures
,
array
$except
=
[])
{
...
...
framework/db/ActiveRelationTrait.php
View file @
76d8e2b5
...
...
@@ -257,7 +257,6 @@ trait ActiveRelationTrait
* @param ActiveRecordInterface[] $models models
* @param string $primaryName the primary relation name
* @param string $name the relation name
* @return null
*/
private
function
populateInverseRelation
(
&
$primaryModels
,
$models
,
$primaryName
,
$name
)
{
...
...
@@ -368,6 +367,10 @@ trait ActiveRelationTrait
return
$buckets
;
}
/**
* @param array $attributes the attributes to prefix
* @return array
*/
private
function
prefixKeyColumns
(
$attributes
)
{
if
(
$this
instanceof
ActiveQuery
&&
(
!
empty
(
$this
->
join
)
||
!
empty
(
$this
->
joinWith
)))
{
...
...
@@ -385,7 +388,7 @@ trait ActiveRelationTrait
}
if
(
isset
(
$alias
))
{
foreach
(
$attributes
as
$i
=>
$attribute
)
{
$attributes
[
$i
]
=
"
$alias
.
$attribute
"
;
$attributes
[
$i
]
=
"
$alias
.
$attribute
"
;
}
}
}
...
...
framework/db/BaseActiveRecord.php
View file @
76d8e2b5
...
...
@@ -911,7 +911,7 @@ abstract class BaseActiveRecord extends Model implements ActiveRecordInterface
*/
public
function
refresh
()
{
/** @var
ActiveQuery
$record */
/** @var
BaseActiveRecord
$record */
$record
=
$this
->
findOne
(
$this
->
getPrimaryKey
(
true
));
if
(
$record
===
null
)
{
return
false
;
...
...
framework/db/Query.php
View file @
76d8e2b5
...
...
@@ -107,6 +107,7 @@ class Query extends Component implements QueryInterface
*/
public
$params
=
[];
/**
* Creates a DB command that can be used to execute this query.
* @param Connection $db the database connection used to generate the SQL statement.
...
...
@@ -201,7 +202,6 @@ class Query extends Component implements QueryInterface
public
function
all
(
$db
=
null
)
{
$rows
=
$this
->
createCommand
(
$db
)
->
queryAll
();
return
$this
->
prepareResult
(
$rows
);
}
...
...
@@ -226,7 +226,6 @@ class Query extends Component implements QueryInterface
}
$result
[
$key
]
=
$row
;
}
return
$result
;
}
...
...
@@ -343,7 +342,6 @@ class Query extends Component implements QueryInterface
$this
->
select
=
[
new
Expression
(
'1'
)];
$command
=
$this
->
createCommand
(
$db
);
$this
->
select
=
$select
;
return
$command
->
queryScalar
()
!==
false
;
}
...
...
@@ -404,7 +402,6 @@ class Query extends Component implements QueryInterface
}
$this
->
select
=
$columns
;
$this
->
selectOption
=
$option
;
return
$this
;
}
...
...
@@ -424,7 +421,6 @@ class Query extends Component implements QueryInterface
}
else
{
$this
->
select
=
array_merge
(
$this
->
select
,
$columns
);
}
return
$this
;
}
...
...
@@ -436,7 +432,6 @@ class Query extends Component implements QueryInterface
public
function
distinct
(
$value
=
true
)
{
$this
->
distinct
=
$value
;
return
$this
;
}
...
...
@@ -462,7 +457,6 @@ class Query extends Component implements QueryInterface
$tables
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$tables
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
$this
->
from
=
$tables
;
return
$this
;
}
...
...
@@ -570,7 +564,6 @@ class Query extends Component implements QueryInterface
$this
->
where
=
[
'and'
,
$this
->
where
,
$condition
];
}
$this
->
addParams
(
$params
);
return
$this
;
}
...
...
@@ -618,7 +611,6 @@ class Query extends Component implements QueryInterface
public
function
join
(
$type
,
$table
,
$on
=
''
,
$params
=
[])
{
$this
->
join
[]
=
[
$type
,
$table
,
$on
];
return
$this
->
addParams
(
$params
);
}
...
...
@@ -643,7 +635,6 @@ class Query extends Component implements QueryInterface
public
function
innerJoin
(
$table
,
$on
=
''
,
$params
=
[])
{
$this
->
join
[]
=
[
'INNER JOIN'
,
$table
,
$on
];
return
$this
->
addParams
(
$params
);
}
...
...
@@ -668,7 +659,6 @@ class Query extends Component implements QueryInterface
public
function
leftJoin
(
$table
,
$on
=
''
,
$params
=
[])
{
$this
->
join
[]
=
[
'LEFT JOIN'
,
$table
,
$on
];
return
$this
->
addParams
(
$params
);
}
...
...
@@ -693,7 +683,6 @@ class Query extends Component implements QueryInterface
public
function
rightJoin
(
$table
,
$on
=
''
,
$params
=
[])
{
$this
->
join
[]
=
[
'RIGHT JOIN'
,
$table
,
$on
];
return
$this
->
addParams
(
$params
);
}
...
...
@@ -712,7 +701,6 @@ class Query extends Component implements QueryInterface
$columns
=
preg_split
(
'/\s*,\s*/'
,
trim
(
$columns
),
-
1
,
PREG_SPLIT_NO_EMPTY
);
}
$this
->
groupBy
=
$columns
;
return
$this
;
}
...
...
@@ -735,7 +723,6 @@ class Query extends Component implements QueryInterface
}
else
{
$this
->
groupBy
=
array_merge
(
$this
->
groupBy
,
$columns
);
}
return
$this
;
}
...
...
@@ -752,7 +739,6 @@ class Query extends Component implements QueryInterface
{
$this
->
having
=
$condition
;
$this
->
addParams
(
$params
);
return
$this
;
}
...
...
@@ -774,7 +760,6 @@ class Query extends Component implements QueryInterface
$this
->
having
=
[
'and'
,
$this
->
having
,
$condition
];
}
$this
->
addParams
(
$params
);
return
$this
;
}
...
...
@@ -796,7 +781,6 @@ class Query extends Component implements QueryInterface
$this
->
having
=
[
'or'
,
$this
->
having
,
$condition
];
}
$this
->
addParams
(
$params
);
return
$this
;
}
...
...
@@ -809,7 +793,6 @@ class Query extends Component implements QueryInterface
public
function
union
(
$sql
,
$all
=
false
)
{
$this
->
union
[]
=
[
'query'
=>
$sql
,
'all'
=>
$all
];
return
$this
;
}
...
...
@@ -823,7 +806,6 @@ class Query extends Component implements QueryInterface
public
function
params
(
$params
)
{
$this
->
params
=
$params
;
return
$this
;
}
...
...
@@ -849,7 +831,6 @@ class Query extends Component implements QueryInterface
}
}
}
return
$this
;
}
}
framework/db/oci/QueryBuilder.php
View file @
76d8e2b5
...
...
@@ -17,7 +17,7 @@ use yii\base\InvalidParamException;
*/
class
QueryBuilder
extends
\yii\db\QueryBuilder
{
private
$sql
;
private
$
_
sql
;
/**
* @inheritdoc
...
...
@@ -37,16 +37,16 @@ class QueryBuilder extends \yii\db\QueryBuilder
$this
->
buildHaving
(
$query
->
having
,
$params
),
$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
);
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
)
...
...
@@ -64,14 +64,14 @@ class QueryBuilder extends \yii\db\QueryBuilder
$filter
=
implode
(
' and '
,
$filters
);
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)
SELECT *
FROM PAGINATION
WHERE $filter
EOD;
}
else
{
return
$this
->
sql
;
return
$this
->
_
sql
;
}
}
...
...
framework/web/Request.php
View file @
76d8e2b5
...
...
@@ -671,15 +671,16 @@ class Request extends \yii\base\Request
// try to encode in UTF8 if not so
// http://w3.org/International/questions/qa-forms-utf-8.html
if
(
!
preg_match
(
'%^(?:
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs'
,
$pathInfo
))
{
[\x09\x0A\x0D\x20-\x7E] # ASCII
| [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
| \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
| [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
| \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
| \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
| [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
| \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
)*$%xs'
,
$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