init
This commit is contained in:
36
ActiveRecord.php
Normal file
36
ActiveRecord.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace dominion\db;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class ActiveRecord extends \yii\db\ActiveRecord
|
||||
{
|
||||
protected static $tableSchemaCache = [];
|
||||
|
||||
/**
|
||||
* этот класс позволяет ускорить работу за счет хранения структуры бд
|
||||
*/
|
||||
public static function getTableSchema()
|
||||
{
|
||||
if(!isset(self::$tableSchemaCache[static::tableName()]))
|
||||
{
|
||||
self::$tableSchemaCache[static::tableName()] = parent::getTableSchema();
|
||||
}
|
||||
return self::$tableSchemaCache[static::tableName()];
|
||||
}
|
||||
|
||||
/**
|
||||
* этот класс позволяет ускорить работу за счет отказа от получения списка атрибутов из схемы бд
|
||||
* /
|
||||
public function attributes()
|
||||
{
|
||||
return array_keys($this->attributeLabels());
|
||||
}*/
|
||||
|
||||
public function init()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user