public function add() { $person = new Person(); $person->first_name = $this->firstName; $person->last_name = $this->lastName; $person->second_name = $this->secondName; $person->save(); $position = new Position(); $position->name = $this->positionName; $position->save(); $employee = new Employee(); $employee->person_id = $person->id; $employee->salary = $this->salary; $employee->save(); }
public function getAllPositions() { return Position::find()->all(); }
public function getPositions() { return $this->hasMany(Position::className(), ['id' => 'position_id'])->viaTable('employee_positions', ['employee_id' => 'id']); }