Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/query/PhameBlogQuery.php
<?php | <?php | ||||
final class PhameBlogQuery extends PhabricatorCursorPagedPolicyAwareQuery { | final class PhameBlogQuery extends PhabricatorCursorPagedPolicyAwareQuery { | ||||
private $ids; | private $ids; | ||||
private $phids; | private $phids; | ||||
private $domain; | private $domain; | ||||
private $statuses; | private $statuses; | ||||
private $needBloggers; | private $needBloggers; | ||||
private $needProfileImage; | private $needProfileImage; | ||||
private $needHeaderImage; | |||||
public function withIDs(array $ids) { | public function withIDs(array $ids) { | ||||
$this->ids = $ids; | $this->ids = $ids; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function withPHIDs(array $phids) { | public function withPHIDs(array $phids) { | ||||
$this->phids = $phids; | $this->phids = $phids; | ||||
Show All 10 Lines | public function withStatuses(array $status) { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function needProfileImage($need) { | public function needProfileImage($need) { | ||||
$this->needProfileImage = $need; | $this->needProfileImage = $need; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function needHeaderImage($need) { | |||||
$this->needHeaderImage = $need; | |||||
return $this; | |||||
} | |||||
public function newResultObject() { | public function newResultObject() { | ||||
return new PhameBlog(); | return new PhameBlog(); | ||||
} | } | ||||
protected function loadPage() { | protected function loadPage() { | ||||
return $this->loadStandardPage($this->newResultObject()); | return $this->loadStandardPage($this->newResultObject()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if ($this->needProfileImage) { | ||||
$this->getViewer(), | $this->getViewer(), | ||||
'blog.png'); | 'blog.png'); | ||||
} | } | ||||
$file = $default; | $file = $default; | ||||
} | } | ||||
$blog->attachProfileImageFile($file); | $blog->attachProfileImageFile($file); | ||||
} | } | ||||
} | } | ||||
if ($this->needHeaderImage) { | |||||
$file_phids = mpull($blogs, 'getHeaderImagePHID'); | |||||
epriestley: Unused? | |||||
$file_phids = array_filter($file_phids); | |||||
if ($file_phids) { | |||||
$files = id(new PhabricatorFileQuery()) | |||||
->setParentQuery($this) | |||||
->setViewer($this->getViewer()) | |||||
->withPHIDs($file_phids) | |||||
->execute(); | |||||
$files = mpull($files, null, 'getPHID'); | |||||
} else { | |||||
$files = array(); | |||||
} | |||||
foreach ($blogs as $blog) { | |||||
$file = idx($files, $blog->getHeaderImagePHID()); | |||||
if ($file) { | |||||
$blog->attachHeaderImageFile($file); | |||||
} | |||||
} | |||||
} | |||||
return $blogs; | return $blogs; | ||||
} | } | ||||
public function getQueryApplicationClass() { | public function getQueryApplicationClass() { | ||||
// TODO: Can we set this without breaking public blogs? | // TODO: Can we set this without breaking public blogs? | ||||
return null; | return null; | ||||
} | } | ||||
} | } |
Unused?