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
a07facf4
Commit
a07facf4
authored
Nov 22, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored hasMany and hasOne so that they support cross-DBMS relationship.
parent
a95d54cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
ActiveRecord.php
framework/yii/db/ActiveRecord.php
+5
-3
ActiveRecord.php
framework/yii/redis/ActiveRecord.php
+1
-1
No files found.
framework/yii/db/ActiveRecord.php
View file @
a07facf4
...
...
@@ -475,7 +475,8 @@ class ActiveRecord extends Model
*/
public
function
hasOne
(
$class
,
$link
)
{
return
$this
->
createActiveRelation
([
/** @var ActiveRecord $class */
return
$class
::
createActiveRelation
([
'modelClass'
=>
$class
,
'primaryModel'
=>
$this
,
'link'
=>
$link
,
...
...
@@ -513,7 +514,8 @@ class ActiveRecord extends Model
*/
public
function
hasMany
(
$class
,
$link
)
{
return
$this
->
createActiveRelation
([
/** @var ActiveRecord $class */
return
$class
::
createActiveRelation
([
'modelClass'
=>
$class
,
'primaryModel'
=>
$this
,
'link'
=>
$link
,
...
...
@@ -528,7 +530,7 @@ class ActiveRecord extends Model
* @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveRelation the newly created [[ActiveRelation]] instance.
*/
p
rotected
function
createActiveRelation
(
$config
=
[])
p
ublic
static
function
createActiveRelation
(
$config
=
[])
{
return
new
ActiveRelation
(
$config
);
}
...
...
framework/yii/redis/ActiveRecord.php
View file @
a07facf4
...
...
@@ -58,7 +58,7 @@ class ActiveRecord extends \yii\db\ActiveRecord
/**
* @inheritDoc
*/
p
rotected
function
createActiveRelation
(
$config
=
[])
p
ublic
static
function
createActiveRelation
(
$config
=
[])
{
return
new
ActiveRelation
(
$config
);
}
...
...
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