コード例 #1
0
ファイル: Election.php プロジェクト: nikolay-angeloff/fmi
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getVoters()
 {
     return $this->hasMany(Voter::className(), ['election_id' => 'id']);
 }
コード例 #2
0
 /**
  * Adds a group.
  * @param integer $groupId
  * @param integer $electionId
  * @return mixed
  */
 public function actionAddGroup($groupId, $electionId)
 {
     $voter = new Voter();
     $voter->election_id = $electionId;
     $voter->group_id = $groupId;
     $voter->save();
     return $this->redirect(['add-group-list', 'electionId' => $electionId]);
 }