/** * Removes a candidate. * @param integer $userId * @param integer $electionId * @return mixed */ public function actionRemoveCandidate($userId, $electionId) { Candidate::findOne(['user_id' => $userId, 'election_id' => $electionId])->delete(); return $this->redirect(['view', 'id' => $electionId]); }