2018-10-11 11:15:09 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace common\models;
|
|
|
|
|
2019-06-26 17:22:10 +03:00
|
|
|
use common\classes\Debug;
|
2018-10-11 11:15:09 +03:00
|
|
|
use Yii;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the model class for table "additional_fields".
|
|
|
|
*
|
|
|
|
* @property int $id
|
|
|
|
* @property string $name
|
|
|
|
*
|
|
|
|
* @property FieldsValue[] $fieldsValues
|
|
|
|
* @property UseField[] $useFields
|
|
|
|
*/
|
|
|
|
class AdditionalFields extends \yii\db\ActiveRecord
|
|
|
|
{
|
|
|
|
public $use = [];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public static function tableName()
|
|
|
|
{
|
|
|
|
return 'additional_fields';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[['name', 'use'], 'required'],
|
|
|
|
[['name'], 'string', 'max' => 100],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritdoc}
|
|
|
|
*/
|
|
|
|
public function attributeLabels()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => 'ID',
|
|
|
|
'name' => 'Название',
|
|
|
|
'use' => 'Применение',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \yii\db\ActiveQuery
|
|
|
|
*/
|
|
|
|
public function getFieldsValues()
|
|
|
|
{
|
2019-06-26 17:22:10 +03:00
|
|
|
return $this->hasMany(FieldsValueNew::className(), ['field_id' => 'id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getObjectValue()
|
|
|
|
{
|
|
|
|
|
2018-10-11 11:15:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \yii\db\ActiveQuery
|
|
|
|
*/
|
|
|
|
public function getUseFields()
|
|
|
|
{
|
|
|
|
return $this->hasMany(UseField::className(), ['field_id' => 'id']);
|
|
|
|
}
|
|
|
|
}
|