/** * @param integer $version_id * @return ActiveRecord */ public function loadVersion($version_id) { /** @var ActiveRecord $owner */ $owner = $this->owner; $modelClass = get_class($owner); $row = (new Query())->select('row_data')->from($this->auditTableName)->where(array_fill_keys($owner->getDb()->getTableSchema($this->auditTableName)->primaryKey, $version_id))->one($owner->getDb()); return ActiveRecord::populateRecord(new $modelClass(), json_decode($row)); }
/** * @param DynamicActiveRecord $record * @param array $row * * @throws Exception */ public static function populateRecord($record, $row) { $dynCol = static::dynamicColumn(); if (isset($row[$dynCol])) { $record->_dynamicAttributes = static::dynColDecode($row[$dynCol]); } parent::populateRecord($record, $row); }
/** * @inheritdoc */ public static function populateRecord($record, $row) { parent::populateRecord($record, $row); $record->value = unserialize($record->value); }
/** * @inheritdoc */ public static function populateRecord($record, $row) { foreach (['user_id', 'contact_id'] as $name) { if (isset($row[$name])) { $row[$name] = intval($row[$name]); } } parent::populateRecord($record, $row); }
public static function populateRecord($record, $row) { $record->_custom_attributes = array_keys($row); parent::populateRecord($record, $row); }