Commit 0bc91f29 by Klimov Paul

Sphinx Active Record relation handling provided.

parent f228f215
......@@ -1126,4 +1126,27 @@ class ActiveRecord extends Model
$transactions = $this->transactions();
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
......@@ -2,9 +2,9 @@
namespace yiiunit\data\sphinx\ar;
use yiiunit\data\ar;
use yiiunit\data\ar\ActiveRecord as ActiveRecordDb;
class ArticleDb extends ActiveRecord
class ArticleDb extends ActiveRecordDb
{
public static function tableName()
{
......
......@@ -2,9 +2,9 @@
namespace yiiunit\data\sphinx\ar;
use yiiunit\data\ar;
use yiiunit\data\ar\ActiveRecord as ActiveRecordDb;
class ItemDb extends ActiveRecord
class ItemDb extends ActiveRecordDb
{
public static function tableName()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment