the project-user is finished
This commit is contained in:
36
common/models/ProjectUser.php
Executable file → Normal file
36
common/models/ProjectUser.php
Executable file → Normal file
@ -8,11 +8,13 @@ use Yii;
|
||||
* This is the model class for table "project_user".
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $card_id
|
||||
* @property int $project_id
|
||||
* @property int $user_id
|
||||
*
|
||||
* @property Project $project
|
||||
* @property UserCard $card
|
||||
* @property User $user
|
||||
* @property Task[] $tasks
|
||||
* @property TaskUser[] $taskUsers
|
||||
*/
|
||||
class ProjectUser extends \yii\db\ActiveRecord
|
||||
{
|
||||
@ -30,10 +32,10 @@ class ProjectUser extends \yii\db\ActiveRecord
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['card_id', 'project_id'], 'required'],
|
||||
[['card_id', 'project_id'], 'integer'],
|
||||
[['project_id', 'user_id'], 'required'],
|
||||
[['project_id', 'user_id'], 'integer'],
|
||||
[['project_id'], 'exist', 'skipOnError' => true, 'targetClass' => Project::className(), 'targetAttribute' => ['project_id' => 'id']],
|
||||
[['card_id'], 'exist', 'skipOnError' => true, 'targetClass' => UserCard::className(), 'targetAttribute' => ['card_id' => 'id']],
|
||||
[['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']],
|
||||
];
|
||||
}
|
||||
|
||||
@ -44,8 +46,8 @@ class ProjectUser extends \yii\db\ActiveRecord
|
||||
{
|
||||
return [
|
||||
'id' => 'ID',
|
||||
'card_id' => 'Card ID',
|
||||
'project_id' => 'Project ID',
|
||||
'project_id' => 'Проект',
|
||||
'user_id' => 'Сотрудник',
|
||||
];
|
||||
}
|
||||
|
||||
@ -60,8 +62,24 @@ class ProjectUser extends \yii\db\ActiveRecord
|
||||
/**
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getCard()
|
||||
public function getUser()
|
||||
{
|
||||
return $this->hasOne(UserCard::className(), ['id' => 'card_id']);
|
||||
return $this->hasOne(User::className(), ['id' => 'user_id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getTasks()
|
||||
{
|
||||
return $this->hasMany(Task::className(), ['project_user_id' => 'id']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \yii\db\ActiveQuery
|
||||
*/
|
||||
public function getTaskUsers()
|
||||
{
|
||||
return $this->hasMany(TaskUser::className(), ['project_user_id' => 'id']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user