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
0bc91f29
Commit
0bc91f29
authored
Nov 16, 2013
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sphinx Active Record relation handling provided.
parent
f228f215
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
ActiveRecord.php
extensions/sphinx/ActiveRecord.php
+24
-0
ArticleDb.php
tests/unit/data/sphinx/ar/ArticleDb.php
+2
-2
ItemDb.php
tests/unit/data/sphinx/ar/ItemDb.php
+2
-2
No files found.
extensions/sphinx/ActiveRecord.php
View file @
0bc91f29
...
@@ -1126,4 +1126,27 @@ class ActiveRecord extends Model
...
@@ -1126,4 +1126,27 @@ class ActiveRecord extends Model
$transactions
=
$this
->
transactions
();
$transactions
=
$this
->
transactions
();
return
isset
(
$transactions
[
$scenario
])
&&
(
$transactions
[
$scenario
]
&
$operation
);
return
isset
(
$transactions
[
$scenario
])
&&
(
$transactions
[
$scenario
]
&
$operation
);
}
}
/**
* Sets the element at the specified offset.
* This method is required by the SPL interface `ArrayAccess`.
* It is implicitly called when you use something like `$model[$offset] = $item;`.
* @param integer $offset the offset to set element
* @param mixed $item the element value
* @throws \Exception on failure
*/
public
function
offsetSet
(
$offset
,
$item
)
{
// Bypass relation owner restriction to 'yii\db\ActiveRecord' at [[ActiveRelationTrait::findWith()]]:
try
{
$relation
=
$this
->
getRelation
(
$offset
);
if
(
is_object
(
$relation
))
{
$this
->
populateRelation
(
$offset
,
$item
);
return
;
}
}
catch
(
UnknownMethodException
$e
)
{
throw
$e
->
getPrevious
();
}
parent
::
offsetSet
(
$offset
,
$item
);
}
}
}
\ No newline at end of file
tests/unit/data/sphinx/ar/ArticleDb.php
View file @
0bc91f29
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
namespace
yiiunit\data\sphinx\ar
;
namespace
yiiunit\data\sphinx\ar
;
use
yiiunit\data\ar
;
use
yiiunit\data\ar
\ActiveRecord
as
ActiveRecordDb
;
class
ArticleDb
extends
ActiveRecord
class
ArticleDb
extends
ActiveRecord
Db
{
{
public
static
function
tableName
()
public
static
function
tableName
()
{
{
...
...
tests/unit/data/sphinx/ar/ItemDb.php
View file @
0bc91f29
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
namespace
yiiunit\data\sphinx\ar
;
namespace
yiiunit\data\sphinx\ar
;
use
yiiunit\data\ar
;
use
yiiunit\data\ar
\ActiveRecord
as
ActiveRecordDb
;
class
ItemDb
extends
ActiveRecord
class
ItemDb
extends
ActiveRecord
Db
{
{
public
static
function
tableName
()
public
static
function
tableName
()
{
{
...
...
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