Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110484793
HarbormasterBuildMessageQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Apr 26, 13:17
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Apr 28, 13:17 (2 d)
Engine
blob
Format
Raw Data
Handle
25823344
Attached To
rPH Phabricator
HarbormasterBuildMessageQuery.php
View Options
<?php
final
class
HarbormasterBuildMessageQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$receiverPHIDs
;
private
$consumed
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withReceiverPHIDs
(
array
$phids
)
{
$this
->
receiverPHIDs
=
$phids
;
return
$this
;
}
public
function
withConsumed
(
$consumed
)
{
$this
->
consumed
=
$consumed
;
return
$this
;
}
public
function
newResultObject
()
{
return
new
HarbormasterBuildMessage
();
}
protected
function
loadPage
()
{
return
$this
->
loadStandardPage
(
$this
->
newResultObject
());
}
protected
function
willFilterPage
(
array
$page
)
{
$receiver_phids
=
array_filter
(
mpull
(
$page
,
'getReceiverPHID'
));
if
(
$receiver_phids
)
{
$receivers
=
id
(
new
PhabricatorObjectQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withPHIDs
(
$receiver_phids
)
->
setParentQuery
(
$this
)
->
execute
();
$receivers
=
mpull
(
$receivers
,
null
,
'getPHID'
);
}
else
{
$receivers
=
array
();
}
foreach
(
$page
as
$key
=>
$message
)
{
$receiver_phid
=
$message
->
getReceiverPHID
();
if
(
empty
(
$receivers
[
$receiver_phid
]))
{
unset
(
$page
[
$key
]);
$this
->
didRejectResult
(
$message
);
continue
;
}
$message
->
attachReceiver
(
$receivers
[
$receiver_phid
]);
}
return
$page
;
}
protected
function
buildWhereClauseParts
(
AphrontDatabaseConnection
$conn
)
{
$where
=
parent
::
buildWhereClauseParts
(
$conn
);
if
(
$this
->
ids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'id IN (%Ld)'
,
$this
->
ids
);
}
if
(
$this
->
receiverPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'receiverPHID IN (%Ls)'
,
$this
->
receiverPHIDs
);
}
if
(
$this
->
consumed
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'isConsumed = %d'
,
(
int
)
$this
->
consumed
);
}
return
$where
;
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorHarbormasterApplication'
;
}
}
Event Timeline
Log In to Comment