Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/query/PholioMockQuery.php
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | public function needTokenCounts($need) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function newResultObject() { | public function newResultObject() { | ||||
return new PholioMock(); | return new PholioMock(); | ||||
} | } | ||||
protected function loadPage() { | protected function loadPage() { | ||||
$mocks = $this->loadStandardPage(new PholioMock()); | $mocks = $this->loadStandardPage($this->newResultObject()); | ||||
if ($mocks && $this->needImages) { | if ($mocks && $this->needImages) { | ||||
self::loadImages($this->getViewer(), $mocks, $this->needInlineComments); | self::loadImages($this->getViewer(), $mocks, $this->needInlineComments); | ||||
} | } | ||||
if ($mocks && $this->needCoverFiles) { | if ($mocks && $this->needCoverFiles) { | ||||
$this->loadCoverFiles($mocks); | $this->loadCoverFiles($mocks); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | $all_images = id(new PholioImageQuery()) | ||||
->withMockPHIDs(array_keys($mock_map)) | ->withMockPHIDs(array_keys($mock_map)) | ||||
->needInlineComments($need_inline_comments) | ->needInlineComments($need_inline_comments) | ||||
->execute(); | ->execute(); | ||||
$image_groups = mgroup($all_images, 'getMockPHID'); | $image_groups = mgroup($all_images, 'getMockPHID'); | ||||
foreach ($mocks as $mock) { | foreach ($mocks as $mock) { | ||||
$mock_images = idx($image_groups, $mock->getPHID(), array()); | $mock_images = idx($image_groups, $mock->getPHID(), array()); | ||||
$mock->attachAllImages($mock_images); | $mock->attachImages($mock_images); | ||||
$active_images = mfilter($mock_images, 'getIsObsolete', true); | |||||
$mock->attachImages(msort($active_images, 'getSequence')); | |||||
} | } | ||||
} | } | ||||
private function loadCoverFiles(array $mocks) { | private function loadCoverFiles(array $mocks) { | ||||
assert_instances_of($mocks, 'PholioMock'); | assert_instances_of($mocks, 'PholioMock'); | ||||
$cover_file_phids = mpull($mocks, 'getCoverPHID'); | $cover_file_phids = mpull($mocks, 'getCoverPHID'); | ||||
$cover_files = id(new PhabricatorFileQuery()) | $cover_files = id(new PhabricatorFileQuery()) | ||||
->setViewer($this->getViewer()) | ->setViewer($this->getViewer()) | ||||
Show All 36 Lines |