yii\shell\YiiCaster::castModel PHP Method

castModel() public static method

Get an array representing the properties of a model.
public static castModel ( ActiveRecord $model ) : array
$model yii\db\ActiveRecord
return array
    public static function castModel(ActiveRecord $model)
    {
        $attributes = array_merge($model->getAttributes(), $model->getRelatedRecords());
        $results = [];
        foreach ($attributes as $key => $value) {
            $results[Caster::PREFIX_VIRTUAL . $key] = $value;
        }
        return $results;
    }
YiiCaster