Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1.  
  2.  
  3.   public function getEmployees()
  4.   {
  5.     return $this->hasMany(Employee::class, ['id' => 'employee_id'])->via('employeeDiffs');
  6.   }
  7.  
  8.   /**
  9.    * Used for chained relation with Employee
  10.    *
  11.    * @return ActiveQuery
  12.    */
  13.   public function getEmployeeDiffs()
  14.   {
  15.     return $this->hasMany(Diff::class, ['value' => 'id'])
  16.       ->via('grades')
  17.       ->andOnCondition(['employee_diffs.diff_type' => Diff::DIFF_TYPE_SALARY_GRADE_CATEGORY]);
  18.   }
  19.  
  20.   public function getGrades(): ActiveQuery
  21.   {
  22.     return $this->hasMany(Grade::class, ['department_id' => 'id']);
  23.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement