本文整理匯總了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);
}