add property and property definition
This commit is contained in:
34
common/models/PropertySettingModel.php
Normal file
34
common/models/PropertySettingModel.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user