本文整理汇总了PHP中yii\db\ActiveRecord::populateRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::populateRecord方法的具体用法?PHP ActiveRecord::populateRecord怎么用?PHP ActiveRecord::populateRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\db\ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::populateRecord方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadVersion
/**
* @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));
}
示例2: populateRecord
/**
* @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);
}
示例3: populateRecord
/**
* @inheritdoc
*/
public static function populateRecord($record, $row)
{
parent::populateRecord($record, $row);
$record->value = unserialize($record->value);
}
示例4: populateRecord
/**
* @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);
}
示例5: populateRecord
public static function populateRecord($record, $row)
{
$record->_custom_attributes = array_keys($row);
parent::populateRecord($record, $row);
}