Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96119210
PhabricatorBadgesAwardQuery.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
Sun, Dec 22, 20:16
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Dec 24, 20:16 (2 d)
Engine
blob
Format
Raw Data
Handle
23126565
Attached To
rPH Phabricator
PhabricatorBadgesAwardQuery.php
View Options
<?php
final
class
PhabricatorBadgesAwardQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$badgePHIDs
;
private
$recipientPHIDs
;
private
$awarderPHIDs
;
protected
function
willFilterPage
(
array
$awards
)
{
$badge_phids
=
array
();
foreach
(
$awards
as
$key
=>
$award
)
{
$badge_phids
[]
=
$award
->
getBadgePHID
();
}
$badges
=
id
(
new
PhabricatorBadgesQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withPHIDs
(
$badge_phids
)
->
execute
();
$badges
=
mpull
(
$badges
,
null
,
'getPHID'
);
foreach
(
$awards
as
$key
=>
$award
)
{
$award_badge
=
idx
(
$badges
,
$award
->
getBadgePHID
());
$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'
;
}
}
Event Timeline
Log In to Comment