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
f228f215
Commit
f228f215
authored
Nov 16, 2013
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"ActiveRelationInterface" applied to Sphinx Active Record.
parent
62968971
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
ActiveRecord.php
extensions/sphinx/ActiveRecord.php
+5
-5
No files found.
extensions/sphinx/ActiveRecord.php
View file @
f228f215
...
...
@@ -12,6 +12,7 @@ use yii\base\InvalidParamException;
use
yii\base\Model
;
use
yii\base\ModelEvent
;
use
yii\base\UnknownMethodException
;
use
yii\db\ActiveRelationInterface
;
use
yii\db\Expression
;
use
yii\db\StaleObjectException
;
use
yii\helpers\Inflector
;
...
...
@@ -324,8 +325,7 @@ class ActiveRecord extends Model
return
$this
->
_related
[
$name
];
}
$value
=
parent
::
__get
(
$name
);
// TODO: relation
if
(
$value
instanceof
ActiveRelation
)
{
if
(
$value
instanceof
ActiveRelationInterface
)
{
return
$this
->
_related
[
$name
]
=
$value
->
multiple
?
$value
->
all
()
:
$value
->
one
();
}
else
{
return
$value
;
...
...
@@ -1094,10 +1094,10 @@ class ActiveRecord extends Model
/**
* Returns the relation object with the specified name.
* A relation is defined by a getter method which returns an [[ActiveRelation]] object.
* A relation is defined by a getter method which returns an [[ActiveRelation
Interface
]] object.
* It can be declared in either the Active Record class itself or one of its behaviors.
* @param string $name the relation name
* @return ActiveRelation the relation object
* @return ActiveRelation
Interface
the relation object
* @throws InvalidParamException if the named relation does not exist.
*/
public
function
getRelation
(
$name
)
...
...
@@ -1105,7 +1105,7 @@ class ActiveRecord extends Model
$getter
=
'get'
.
$name
;
try
{
$relation
=
$this
->
$getter
();
if
(
$relation
instanceof
ActiveRelation
)
{
if
(
$relation
instanceof
ActiveRelation
Interface
)
{
return
$relation
;
}
else
{
return
null
;
...
...
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