add property and property definition
This commit is contained in:
44
common/models/PropertySetting.php
Normal file
44
common/models/PropertySetting.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace common\models;
|
||||
|
||||
use yii\base\BaseObject;
|
||||
|
||||
/**
|
||||
* @property \common\models\PropertyDefinition $definition
|
||||
* @property \common\models\Property $property
|
||||
*/
|
||||
class PropertySetting extends BaseObject
|
||||
{
|
||||
|
||||
public $definition;
|
||||
public $property;
|
||||
|
||||
public function getValue(){
|
||||
$value = null;
|
||||
if ( isset($this->property)){
|
||||
$value = $this->property->value;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function setValue($value){
|
||||
|
||||
// @property integer $id
|
||||
// * @property integer $id_user
|
||||
// * @property integer $id_property_definition
|
||||
// * @property string $value
|
||||
$this->property = new Property(
|
||||
[
|
||||
'id_user' => \Yii::$app->user->id,
|
||||
'id_property_definition' => $this->definition->id,
|
||||
'value' => $value
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function getLabel(){
|
||||
return $this->definition->label;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user