Exemple #1
0
 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();
 }
Exemple #2
0
 public function getAllPositions()
 {
     return Position::find()->all();
 }
Exemple #3
0
 public function getPositions()
 {
     return $this->hasMany(Position::className(), ['id' => 'position_id'])->viaTable('employee_positions', ['employee_id' => 'id']);
 }