From b1fe72782fe8746777622bb7902df1577b2b40c3 Mon Sep 17 00:00:00 2001 From: Anton M Date: Thu, 6 Apr 2017 23:46:11 +0300 Subject: [PATCH] Check Interface instead of Class Only pure Active Record API is used so it should work with any DB driver --- src/SaveRelationsBehavior.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SaveRelationsBehavior.php b/src/SaveRelationsBehavior.php index 69cf05b..a75063b 100644 --- a/src/SaveRelationsBehavior.php +++ b/src/SaveRelationsBehavior.php @@ -8,6 +8,7 @@ use yii\base\Behavior; use yii\base\Exception; use yii\base\ModelEvent; use yii\db\ActiveQuery; +use yii\db\ActiveQueryInterface; use yii\db\ActiveRecord; use yii\db\Transaction; use yii\helpers\ArrayHelper; @@ -58,7 +59,7 @@ class SaveRelationsBehavior extends Behavior public function canSetProperty($name, $checkVars = true) { $getter = 'get' . $name; - if (in_array($name, $this->relations) && method_exists($this->owner, $getter) && $this->owner->$getter() instanceof ActiveQuery) { + if (in_array($name, $this->relations) && method_exists($this->owner, $getter) && $this->owner->$getter() instanceof ActiveQueryInterface) { return true; } return parent::canSetProperty($name, $checkVars);