/** * * * @return null if participant is not voted yet or Answer object */ public function findParticipantAnswerForVote($participantId, $voteId) { $_t = new AnswersTable(); $_select = $_t->select()->setIntegrityCheck(false)->from(array("a" => "answers"))->join(array("pa" => "participant_answers"), "pa.vote_id = a.vote_id AND a.id = pa.answer_id")->where("pa.vote_id = ?", $voteId)->where("pa.participant_id = ?", $participantId)->columns("a.*"); $_result = $_t->fetchRow($_select); return $_result; }