Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2341470
PhabricatorBadgesQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorBadgesQuery.php
View Options
<?php
final
class
PhabricatorBadgesQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$phids
;
private
$qualities
;
private
$statuses
;
private
$recipientPHIDs
;
private
$needRecipients
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withPHIDs
(
array
$phids
)
{
$this
->
phids
=
$phids
;
return
$this
;
}
public
function
withQualities
(
array
$qualities
)
{
$this
->
qualities
=
$qualities
;
return
$this
;
}
public
function
withStatuses
(
array
$statuses
)
{
$this
->
statuses
=
$statuses
;
return
$this
;
}
public
function
withRecipientPHIDs
(
array
$recipient_phids
)
{
$this
->
recipientPHIDs
=
$recipient_phids
;
return
$this
;
}
public
function
needRecipients
(
$need_recipients
)
{
$this
->
needRecipients
=
$need_recipients
;
return
$this
;
}
protected
function
loadPage
()
{
return
$this
->
loadStandardPage
(
$this
->
newResultObject
());
}
public
function
newResultObject
()
{
return
new
PhabricatorBadgesBadge
();
}
protected
function
didFilterPage
(
array
$badges
)
{
if
(
$this
->
needRecipients
)
{
$query
=
id
(
new
PhabricatorBadgesAwardQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withBadgePHIDs
(
mpull
(
$badges
,
'getPHID'
))
->
execute
();
$awards
=
mgroup
(
$query
,
'getBadgePHID'
);
foreach
(
$badges
as
$badge
)
{
$badge_awards
=
idx
(
$awards
,
$badge
->
getPHID
(),
array
());
$badge
->
attachAwards
(
$badge_awards
);
}
}
return
$badges
;
}
protected
function
buildWhereClauseParts
(
AphrontDatabaseConnection
$conn
)
{
$where
=
parent
::
buildWhereClauseParts
(
$conn
);
if
(
$this
->
ids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'id IN (%Ld)'
,
$this
->
ids
);
}
if
(
$this
->
phids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'phid IN (%Ls)'
,
$this
->
phids
);
}
if
(
$this
->
qualities
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'quality IN (%Ls)'
,
$this
->
qualities
);
}
if
(
$this
->
statuses
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'status IN (%Ls)'
,
$this
->
statuses
);
}
return
$where
;
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorBadgesApplication'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 9:35 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
446163
Default Alt Text
PhabricatorBadgesQuery.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment