Commit d0fc987f by Carsten Brandt

fixed test break

parent ff52f28d
...@@ -9,6 +9,7 @@ namespace yii\redis; ...@@ -9,6 +9,7 @@ namespace yii\redis;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
use yii\base\NotSupportedException; use yii\base\NotSupportedException;
use yii\db\BaseActiveRecord;
use yii\helpers\StringHelper; use yii\helpers\StringHelper;
/** /**
...@@ -34,7 +35,7 @@ use yii\helpers\StringHelper; ...@@ -34,7 +35,7 @@ use yii\helpers\StringHelper;
* @author Carsten Brandt <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0
*/ */
class ActiveRecord extends \yii\db\ActiveRecord class ActiveRecord extends BaseActiveRecord
{ {
/** /**
* Returns the database connection used by this AR class. * Returns the database connection used by this AR class.
......
...@@ -104,7 +104,7 @@ trait ActiveRelationTrait ...@@ -104,7 +104,7 @@ trait ActiveRelationTrait
if (count($primaryModels) === 1 && !$this->multiple) { if (count($primaryModels) === 1 && !$this->multiple) {
$model = $this->one(); $model = $this->one();
foreach ($primaryModels as $i => $primaryModel) { foreach ($primaryModels as $i => $primaryModel) {
if ($primaryModel instanceof ActiveRecord) { if ($primaryModel instanceof ActiveRecordInterface) {
$primaryModel->populateRelation($name, $model); $primaryModel->populateRelation($name, $model);
} else { } else {
$primaryModels[$i][$name] = $model; $primaryModels[$i][$name] = $model;
...@@ -123,7 +123,7 @@ trait ActiveRelationTrait ...@@ -123,7 +123,7 @@ trait ActiveRelationTrait
foreach ($primaryModels as $i => $primaryModel) { foreach ($primaryModels as $i => $primaryModel) {
$key = $this->getModelKey($primaryModel, $link); $key = $this->getModelKey($primaryModel, $link);
$value = isset($buckets[$key]) ? $buckets[$key] : ($this->multiple ? [] : null); $value = isset($buckets[$key]) ? $buckets[$key] : ($this->multiple ? [] : null);
if ($primaryModel instanceof ActiveRecord) { if ($primaryModel instanceof ActiveRecordInterface) {
$primaryModel->populateRelation($name, $value); $primaryModel->populateRelation($name, $value);
} else { } else {
$primaryModels[$i][$name] = $value; $primaryModels[$i][$name] = $value;
......
...@@ -11,6 +11,7 @@ use Yii; ...@@ -11,6 +11,7 @@ use Yii;
use yii\base\Component; use yii\base\Component;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
use yii\db\ActiveRecord; use yii\db\ActiveRecord;
use yii\db\ActiveRecordInterface;
use yii\db\Connection; use yii\db\Connection;
/** /**
...@@ -92,7 +93,7 @@ class DbFixtureManager extends Component ...@@ -92,7 +93,7 @@ class DbFixtureManager extends Component
foreach ($fixtures as $name => $fixture) { foreach ($fixtures as $name => $fixture) {
if (strpos($fixture, '\\') !== false) { if (strpos($fixture, '\\') !== false) {
$model = new $fixture; $model = new $fixture;
if ($model instanceof ActiveRecord) { if ($model instanceof ActiveRecordInterface) {
$this->_modelClasses[$name] = $fixture; $this->_modelClasses[$name] = $fixture;
$fixtures[$name] = $model->getTableSchema()->name; $fixtures[$name] = $model->getTableSchema()->name;
} else { } else {
......
...@@ -10,6 +10,7 @@ namespace yii\validators; ...@@ -10,6 +10,7 @@ namespace yii\validators;
use Yii; use Yii;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
use yii\db\ActiveRecord; use yii\db\ActiveRecord;
use yii\db\ActiveRecordInterface;
/** /**
* UniqueValidator validates that the attribute value is unique in the corresponding database table. * UniqueValidator validates that the attribute value is unique in the corresponding database table.
...@@ -67,7 +68,7 @@ class UniqueValidator extends Validator ...@@ -67,7 +68,7 @@ class UniqueValidator extends Validator
$query = $className::find(); $query = $className::find();
$query->where([$attributeName => $value]); $query->where([$attributeName => $value]);
if (!$object instanceof ActiveRecord || $object->getIsNewRecord()) { if (!$object instanceof ActiveRecordInterface || $object->getIsNewRecord()) {
// if current $object isn't in the database yet then it's OK just to call exists() // if current $object isn't in the database yet then it's OK just to call exists()
$exists = $query->exists(); $exists = $query->exists();
} else { } else {
......
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