Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2359779
PhabricatorBadgesAwardQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
PhabricatorBadgesAwardQuery.php
View Options
<?php
final
class
PhabricatorBadgesAwardQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$badgePHIDs
;
private
$recipientPHIDs
;
private
$awarderPHIDs
;
protected
function
willFilterPage
(
array
$awards
)
{
$badges
=
id
(
new
PhabricatorBadgesQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withRecipientPHIDs
(
mpull
(
$awards
,
null
,
'getRecipientPHID'
))
->
execute
();
$badges
=
mpull
(
$badges
,
null
,
'getPHID'
);
foreach
(
$awards
as
$key
=>
$award
)
{
$award_badge
=
idx
(
$badges
,
$award
->
getBadgePHID
());
if
(
$award_badge
===
null
)
{
$this
->
didRejectResult
(
$award
);
unset
(
$awards
[
$key
]);
continue
;
}
$award
->
attachBadge
(
$award_badge
);
}
return
$awards
;
}
public
function
withBadgePHIDs
(
array
$phids
)
{
$this
->
badgePHIDs
=
$phids
;
return
$this
;
}
public
function
withRecipientPHIDs
(
array
$phids
)
{
$this
->
recipientPHIDs
=
$phids
;
return
$this
;
}
public
function
withAwarderPHIDs
(
array
$phids
)
{
$this
->
awarderPHIDs
=
$phids
;
return
$this
;
}
protected
function
loadPage
()
{
return
$this
->
loadStandardPage
(
$this
->
newResultObject
());
}
public
function
newResultObject
()
{
return
new
PhabricatorBadgesAward
();
}
protected
function
buildWhereClauseParts
(
AphrontDatabaseConnection
$conn
)
{
$where
=
parent
::
buildWhereClauseParts
(
$conn
);
if
(
$this
->
badgePHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'badgePHID IN (%Ls)'
,
$this
->
badgePHIDs
);
}
if
(
$this
->
recipientPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'recipientPHID IN (%Ls)'
,
$this
->
recipientPHIDs
);
}
if
(
$this
->
awarderPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'awarderPHID IN (%Ls)'
,
$this
->
awarderPHIDs
);
}
return
$where
;
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorBadgesApplication'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 3:23 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
405799
Default Alt Text
PhabricatorBadgesAwardQuery.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment