3 final class PhabricatorCalendarImportLogQuery
4 extends PhabricatorCursorPagedPolicyAwareQuery
{
10 public function withIDs(array $ids) {
15 public function withPHIDs(array $phids) {
16 $this->phids
= $phids;
20 public function withImportPHIDs(array $phids) {
21 $this->importPHIDs
= $phids;
25 public function newResultObject() {
26 return new PhabricatorCalendarImportLog();
29 protected function loadPage() {
30 return $this->loadStandardPage($this->newResultObject());
33 protected function buildWhereClauseParts(AphrontDatabaseConnection
$conn) {
34 $where = parent
::buildWhereClauseParts($conn);
36 if ($this->ids
!== null) {
43 if ($this->phids
!== null) {
50 if ($this->importPHIDs
!== null) {
53 'log.importPHID IN (%Ls)',
61 protected function willFilterPage(array $page) {
62 $viewer = $this->getViewer();
64 $type_map = PhabricatorCalendarImportLogType
::getAllLogTypes();
65 foreach ($page as $log) {
66 $type_constant = $log->getParameter('type');
68 $type_object = idx($type_map, $type_constant);
70 $type_object = new PhabricatorCalendarImportDefaultLogType();
73 $type_object = clone $type_object;
74 $log->attachLogType($type_object);
77 $import_phids = mpull($page, 'getImportPHID');
80 $imports = id(new PhabricatorCalendarImportQuery())
82 ->withPHIDs($import_phids)
84 $imports = mpull($imports, null, 'getPHID');
89 foreach ($page as $key => $log) {
90 $import = idx($imports, $log->getImportPHID());
92 $this->didRejectResult($import);
97 $log->attachImport($import);
103 protected function getPrimaryTableAlias() {
107 public function getQueryApplicationClass() {
108 return 'PhabricatorCalendarApplication';