Commit 39a1ce40 by Carsten Brandt

Redis concept finished except relations

parent f642caf1
...@@ -45,7 +45,7 @@ class ActiveRelation extends ActiveQuery ...@@ -45,7 +45,7 @@ class ActiveRelation extends ActiveQuery
* @var array the columns of the primary and foreign tables that establish the relation. * @var array the columns of the primary and foreign tables that establish the relation.
* The array keys must be columns of the table for this relation, and the array values * The array keys must be columns of the table for this relation, and the array values
* must be the corresponding columns from the primary table. * must be the corresponding columns from the primary table.
* Do not prefix or quote the column names as they will be done automatically by Yii. * Do not prefix or quote the column names as this will be done automatically by Yii.
*/ */
public $link; public $link;
/** /**
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
namespace yii\db\redis; namespace yii\db\redis;
use yii\base\NotSupportedException;
/** /**
* ActiveRecord is the base class for classes representing relational data in terms of objects. * ActiveRecord is the base class for classes representing relational data in terms of objects.
* *
...@@ -25,7 +27,7 @@ abstract class ActiveRecord extends \yii\db\ActiveRecord ...@@ -25,7 +27,7 @@ abstract class ActiveRecord extends \yii\db\ActiveRecord
* The default implementation will return all column names of the table associated with this AR class. * The default implementation will return all column names of the table associated with this AR class.
* @return array list of attribute names. * @return array list of attribute names.
*/ */
public function attributes() public function attributes() // TODO: refactor should be abstract in an ActiveRecord base class
{ {
return array(); return array();
} }
...@@ -93,9 +95,7 @@ abstract class ActiveRecord extends \yii\db\ActiveRecord ...@@ -93,9 +95,7 @@ abstract class ActiveRecord extends \yii\db\ActiveRecord
*/ */
public static function findBySql($sql, $params = array()) public static function findBySql($sql, $params = array())
{ {
$query = static::createQuery(); throw new NotSupportedException('findBySql() is not supported by redis ActiveRecord');
$query->sql = $sql;
return $query->params($params);
} }
...@@ -121,7 +121,7 @@ abstract class ActiveRecord extends \yii\db\ActiveRecord ...@@ -121,7 +121,7 @@ abstract class ActiveRecord extends \yii\db\ActiveRecord
*/ */
public static function getTableSchema() public static function getTableSchema()
{ {
return static::getDb()->getTableSchema(static::tableName()); throw new NotSupportedException('getTableSchema() is not supported by redis ActiveRecord as there is no schema in redis DB. Schema is defined by AR class itself');
} }
/** /**
...@@ -137,9 +137,9 @@ abstract class ActiveRecord extends \yii\db\ActiveRecord ...@@ -137,9 +137,9 @@ abstract class ActiveRecord extends \yii\db\ActiveRecord
* *
* @return string[] the primary keys of the associated database table. * @return string[] the primary keys of the associated database table.
*/ */
public static function primaryKey() public static function primaryKey() // TODO: refactor should be abstract in an ActiveRecord base class
{ {
return static::getTableSchema()->primaryKey; return array();
} }
} }
...@@ -19,5 +19,5 @@ namespace yii\db\redis; ...@@ -19,5 +19,5 @@ namespace yii\db\redis;
*/ */
class ActiveRelation extends \yii\db\ActiveRelation class ActiveRelation extends \yii\db\ActiveRelation
{ {
// TODO implement
} }
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