Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getEmployees()
- {
- return $this->hasMany(Employee::class, ['id' => 'employee_id'])->via('employeeDiffs');
- }
- /**
- * Used for chained relation with Employee
- *
- * @return ActiveQuery
- */
- public function getEmployeeDiffs()
- {
- return $this->hasMany(Diff::class, ['value' => 'id'])
- ->via('grades')
- ->andOnCondition(['employee_diffs.diff_type' => Diff::DIFF_TYPE_SALARY_GRADE_CATEGORY]);
- }
- public function getGrades(): ActiveQuery
- {
- return $this->hasMany(Grade::class, ['department_id' => 'id']);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement