35 lines
719 B
PHP
35 lines
719 B
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use yii\base\Model;
|
|
|
|
class PropertySettingModel extends Model
|
|
{
|
|
public $id_definition;
|
|
public $value;
|
|
public $label;
|
|
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['id_definition',"value"], 'required'],
|
|
[['id_definition',"value"], 'integer'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param PropertySetting $setting
|
|
* @return PropertySettingModel
|
|
*/
|
|
public static function fromPropertySetting($setting){
|
|
$result = new PropertySettingModel();
|
|
$result->value = $setting->getValue();
|
|
$result->label = $setting->getLabel();
|
|
$result->id_definition = $setting->definition->id;
|
|
return $result;
|
|
}
|
|
|
|
|
|
}
|