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
034d88e5
Commit
034d88e5
authored
May 06, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes issue #134
parent
3ca98d45
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
ActiveRecord.md
docs/api/db/ActiveRecord.md
+2
-2
ActiveQuery.php
framework/db/ActiveQuery.php
+2
-1
Customer.php
tests/unit/data/ar/Customer.php
+1
-1
No files found.
docs/api/db/ActiveRecord.md
View file @
034d88e5
...
@@ -412,7 +412,7 @@ class Customer extends \yii\db\ActiveRecord
...
@@ -412,7 +412,7 @@ class Customer extends \yii\db\ActiveRecord
/**
/**
* @param ActiveQuery $query
* @param ActiveQuery $query
*/
*/
public function active($query)
public
static
function active($query)
{
{
$query->andWhere('status = 1');
$query->andWhere('status = 1');
}
}
...
@@ -435,7 +435,7 @@ class Customer extends \yii\db\ActiveRecord
...
@@ -435,7 +435,7 @@ class Customer extends \yii\db\ActiveRecord
* @param ActiveQuery $query
* @param ActiveQuery $query
* @param integer $age
* @param integer $age
*/
*/
public function olderThan($query, $age = 30)
public
static
function olderThan($query, $age = 30)
{
{
$query->andWhere('age > :age', array(':age' => $age));
$query->andWhere('age > :age', array(':age' => $age));
}
}
...
...
framework/db/ActiveQuery.php
View file @
034d88e5
...
@@ -88,7 +88,8 @@ class ActiveQuery extends Query
...
@@ -88,7 +88,8 @@ class ActiveQuery extends Query
{
{
if
(
method_exists
(
$this
->
modelClass
,
$name
))
{
if
(
method_exists
(
$this
->
modelClass
,
$name
))
{
array_unshift
(
$params
,
$this
);
array_unshift
(
$params
,
$this
);
return
call_user_func_array
(
array
(
$this
->
modelClass
,
$name
),
$params
);
call_user_func_array
(
array
(
$this
->
modelClass
,
$name
),
$params
);
return
$this
;
}
else
{
}
else
{
return
parent
::
__call
(
$name
,
$params
);
return
parent
::
__call
(
$name
,
$params
);
}
}
...
...
tests/unit/data/ar/Customer.php
View file @
034d88e5
...
@@ -22,6 +22,6 @@ class Customer extends ActiveRecord
...
@@ -22,6 +22,6 @@ class Customer extends ActiveRecord
public
static
function
active
(
$query
)
public
static
function
active
(
$query
)
{
{
return
$query
->
andWhere
(
'status=1'
);
$query
->
andWhere
(
'status=1'
);
}
}
}
}
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