public function vote($voteId, $answerId, $participantId) { if (null === $this->findParticipantAnswerForVote($participantId, $voteId)) { $_row = $this->createRow(); $_row->vote_id = $voteId; $_row->answer_id = $answerId; $_row->participant_id = $participantId; $_row->insert(); //Now Update the vote count for the answer.... $_answersTable = new AnswersTable(); $_answer = $_answersTable->findById($answerId); $_answer->vote_count += 1; $_answer->save(); } }