* @since 2.0.12 */ class Employee extends ActiveRecord { /** * @inheritdoc */ public static function tableName() { return 'employee'; } /** * Returns employee full name. * * @return string */ public function getFullName() { $fullName = $this->first_name . ' ' . $this->last_name; return $fullName; } /** * Returns employee department. * * @return ActiveQuery */ public function getDepartment() { return $this ->hasOne(Department::className(), [ 'id' => 'department_id', ]) ->inverseOf('employees') ; } /** * Returns employee department. * * @return ActiveQuery */ public function getDossier() { return $this ->hasOne(Dossier::className(), [ 'department_id' => 'department_id', 'employee_id' => 'id', ]) ->inverseOf('employee') ; } }