Changeset View
Changeset View
Standalone View
Standalone View
src/applications/ponder/query/PonderQuestionQuery.php
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | final class PonderQuestionQuery | ||||
| protected function willFilterPage(array $questions) { | protected function willFilterPage(array $questions) { | ||||
| $phids = mpull($questions, 'getPHID'); | $phids = mpull($questions, 'getPHID'); | ||||
| if ($this->needAnswers) { | if ($this->needAnswers) { | ||||
| $aquery = id(new PonderAnswerQuery()) | $aquery = id(new PonderAnswerQuery()) | ||||
| ->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
| ->setOrderVector(array('-id')) | ->setOrderVector(array('-id')) | ||||
| ->needViewerVotes(true) | |||||
| ->withQuestionIDs(mpull($questions, 'getID')); | ->withQuestionIDs(mpull($questions, 'getID')); | ||||
| $answers = $aquery->execute(); | $answers = $aquery->execute(); | ||||
| $answers = mgroup($answers, 'getQuestionID'); | $answers = mgroup($answers, 'getQuestionID'); | ||||
| foreach ($questions as $question) { | foreach ($questions as $question) { | ||||
| $question_answers = idx($answers, $question->getID(), array()); | $question_answers = idx($answers, $question->getID(), array()); | ||||
| $question->attachAnswers(mpull($question_answers, null, 'getPHID')); | $question->attachAnswers(mpull($question_answers, null, 'getPHID')); | ||||
| ▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines | |||||