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 buildWhereClauseParts(AphrontDatabaseConnection
$conn) {
30 $where = parent
::buildWhereClauseParts($conn);
32 if ($this->ids
!== null) {
39 if ($this->phids
!== null) {
46 if ($this->importPHIDs
!== null) {
49 'log.importPHID IN (%Ls)',
57 protected function willFilterPage(array $page) {
58 $viewer = $this->getViewer();
60 $type_map = PhabricatorCalendarImportLogType
::getAllLogTypes();
61 foreach ($page as $log) {
62 $type_constant = $log->getParameter('type');
64 $type_object = idx($type_map, $type_constant);
66 $type_object = new PhabricatorCalendarImportDefaultLogType();
69 $type_object = clone $type_object;
70 $log->attachLogType($type_object);
73 $import_phids = mpull($page, 'getImportPHID');
76 $imports = id(new PhabricatorCalendarImportQuery())
78 ->withPHIDs($import_phids)
80 $imports = mpull($imports, null, 'getPHID');
85 foreach ($page as $key => $log) {
86 $import = idx($imports, $log->getImportPHID());
88 $this->didRejectResult($import);
93 $log->attachImport($import);
99 protected function getPrimaryTableAlias() {
103 public function getQueryApplicationClass() {
104 return 'PhabricatorCalendarApplication';