From ff52f28d0a806aec3fd40d968de15dc0978f0210 Mon Sep 17 00:00:00 2001 From: Carsten Brandt <mail@cebe.cc> Date: Sat, 30 Nov 2013 01:30:31 +0100 Subject: [PATCH] adjusted elasticsearch and redis AR to use BaseAR --- extensions/elasticsearch/ActiveRecord.php | 47 +++-------------------------------------------- extensions/redis/ActiveRecord.php | 27 --------------------------- 2 files changed, 3 insertions(+), 71 deletions(-) diff --git a/extensions/elasticsearch/ActiveRecord.php b/extensions/elasticsearch/ActiveRecord.php index b04e67d..d6ada20 100644 --- a/extensions/elasticsearch/ActiveRecord.php +++ b/extensions/elasticsearch/ActiveRecord.php @@ -10,6 +10,8 @@ namespace yii\elasticsearch; use yii\base\InvalidCallException; use yii\base\InvalidConfigException; use yii\base\NotSupportedException; +use yii\db\ActiveRecordInterface; +use yii\db\BaseActiveRecord; use yii\helpers\Inflector; use yii\helpers\Json; use yii\helpers\StringHelper; @@ -42,7 +44,7 @@ use yii\helpers\StringHelper; * @author Carsten Brandt <mail@cebe.cc> * @since 2.0 */ -class ActiveRecord extends \yii\db\ActiveRecord +class ActiveRecord extends BaseActiveRecord { const PRIMARY_KEY_NAME = 'id'; @@ -428,47 +430,4 @@ class ActiveRecord extends \yii\db\ActiveRecord } 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; - } } diff --git a/extensions/redis/ActiveRecord.php b/extensions/redis/ActiveRecord.php index 1239a6c..1c6b70a 100644 --- a/extensions/redis/ActiveRecord.php +++ b/extensions/redis/ActiveRecord.php @@ -292,31 +292,4 @@ class ActiveRecord extends \yii\db\ActiveRecord } 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; - } } -- libgit2 0.27.1