add new fields
This commit is contained in:
@ -14,6 +14,12 @@ use yii\db\Expression;
|
||||
* @property string $description
|
||||
* @property string $created_at
|
||||
* @property string $updated_at
|
||||
* @property string $budget
|
||||
* @property int $company_id
|
||||
*
|
||||
* @property FieldsValue[] $fieldsValues
|
||||
* @property Company $company
|
||||
* @property ProjectUser[] $projectUsers
|
||||
*/
|
||||
class Project extends \yii\db\ActiveRecord
|
||||
{
|
||||
@ -47,6 +53,8 @@ class Project extends \yii\db\ActiveRecord
|
||||
[['description'], 'string'],
|
||||
[['created_at', 'updated_at'], 'safe'],
|
||||
[['name'], 'string', 'max' => 255],
|
||||
[['budget'], 'string', 'max' => 100],
|
||||
[['company_id'], 'exist', 'skipOnError' => true, 'targetClass' => Company::class, 'targetAttribute' => ['company_id' => 'id']],
|
||||
];
|
||||
}
|
||||
|
||||
@ -61,6 +69,32 @@ class Project extends \yii\db\ActiveRecord
|
||||
'description' => 'Описание',
|
||||
'created_at' => 'Дата создания',
|
||||
'updated_at' => 'Дата редактирования',
|
||||
'budget' => 'Бюджет',
|
||||
'company_id' => 'Компания',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getFieldsValues()
|
||||
{
|
||||
return $this->hasMany(FieldsValue::class, ['project_id' => 'id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getCompany()
|
||||
{
|
||||
return $this->hasOne(Company::class, ['id' => 'company_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getProjectUsers()
|
||||
{
|
||||
return $this->hasMany(ProjectUser::class, ['project_id' => 'id']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user