Commit ff52f28d by Carsten Brandt

adjusted elasticsearch and redis AR to use BaseAR

parent c3eb4d92
...@@ -10,6 +10,8 @@ namespace yii\elasticsearch; ...@@ -10,6 +10,8 @@ namespace yii\elasticsearch;
use yii\base\InvalidCallException; use yii\base\InvalidCallException;
use yii\base\InvalidConfigException; use yii\base\InvalidConfigException;
use yii\base\NotSupportedException; use yii\base\NotSupportedException;
use yii\db\ActiveRecordInterface;
use yii\db\BaseActiveRecord;
use yii\helpers\Inflector; use yii\helpers\Inflector;
use yii\helpers\Json; use yii\helpers\Json;
use yii\helpers\StringHelper; use yii\helpers\StringHelper;
...@@ -42,7 +44,7 @@ use yii\helpers\StringHelper; ...@@ -42,7 +44,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
{ {
const PRIMARY_KEY_NAME = 'id'; const PRIMARY_KEY_NAME = 'id';
...@@ -428,47 +430,4 @@ class ActiveRecord extends \yii\db\ActiveRecord ...@@ -428,47 +430,4 @@ class ActiveRecord extends \yii\db\ActiveRecord
} }
return $n; return $n;
} }
/**
* @inheritdoc
*/
public static function updateAllCounters($counters, $condition = null, $params = [])
{
throw new NotSupportedException('Update Counters is not supported by elasticsearch ActiveRecord.');
}
/**
* @inheritdoc
*/
public static function getTableSchema()
{
throw new NotSupportedException('getTableSchema() is not supported by elasticsearch ActiveRecord.');
}
/**
* @inheritdoc
*/
public static function tableName()
{
return static::index() . '/' . static::type();
}
/**
* @inheritdoc
*/
public static function findBySql($sql, $params = [])
{
throw new NotSupportedException('findBySql() is not supported by elasticsearch ActiveRecord.');
}
/**
* Returns a value indicating whether the specified operation is transactional in the current [[scenario]].
* This method will always return false as transactional operations are not supported by elasticsearch.
* @param integer $operation the operation to check. Possible values are [[OP_INSERT]], [[OP_UPDATE]] and [[OP_DELETE]].
* @return boolean whether the specified operation is transactional in the current [[scenario]].
*/
public function isTransactional($operation)
{
return false;
}
} }
...@@ -292,31 +292,4 @@ class ActiveRecord extends \yii\db\ActiveRecord ...@@ -292,31 +292,4 @@ class ActiveRecord extends \yii\db\ActiveRecord
} }
return md5(json_encode($key)); return md5(json_encode($key));
} }
/**
* @inheritdoc
*/
public static function getTableSchema()
{
throw new NotSupportedException('getTableSchema() is not supported by redis ActiveRecord.');
}
/**
* @inheritdoc
*/
public static function findBySql($sql, $params = [])
{
throw new NotSupportedException('findBySql() is not supported by redis ActiveRecord.');
}
/**
* Returns a value indicating whether the specified operation is transactional in the current [[scenario]].
* This method will always return false as transactional operations are not supported by redis.
* @param integer $operation the operation to check. Possible values are [[OP_INSERT]], [[OP_UPDATE]] and [[OP_DELETE]].
* @return boolean whether the specified operation is transactional in the current [[scenario]].
*/
public function isTransactional($operation)
{
return false;
}
} }
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