Example #1
0
 protected function validateAssignExist($user_id)
 {
     if (($model = ProjectAssignments::find()->where(['user_id' => $user_id, 'project_id' => $this->id])->one()) !== null) {
         return true;
     } else {
         return false;
     }
 }
 public function isUserAssignedToProject($user_id, $project_id)
 {
     $projectAssignments = ProjectAssignments::find()->where(['user_id' => $user_id, 'project_id' => $project_id])->all();
     return count($projectAssignments) > 0;
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProjectAssignments()
 {
     return $this->hasMany(ProjectAssignments::className(), ['project_id' => 'id']);
 }
 public function isProjectBelongToMember($project_id, $user_id)
 {
     $projectAssignments = ProjectAssignments::find()->where(['user_id' => $user_id, 'project_id' => $project_id])->all();
     return count($projectAssignments) > 0;
 }