Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1652839
FundBackerQuery.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
FundBackerQuery.php
View Options
<?php
final
class
FundBackerQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$phids
;
private
$initiativePHIDs
;
private
$backerPHIDs
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withPHIDs
(
array
$phids
)
{
$this
->
phids
=
$phids
;
return
$this
;
}
public
function
withInitiativePHIDs
(
array
$phids
)
{
$this
->
initiativePHIDs
=
$phids
;
return
$this
;
}
public
function
withBackerPHIDs
(
array
$phids
)
{
$this
->
backerPHIDs
=
$phids
;
return
$this
;
}
protected
function
loadPage
()
{
$table
=
new
FundBacker
();
$conn_r
=
$table
->
establishConnection
(
'r'
);
$rows
=
queryfx_all
(
$conn_r
,
'SELECT * FROM %T %Q %Q %Q'
,
$table
->
getTableName
(),
$this
->
buildWhereClause
(
$conn_r
),
$this
->
buildOrderClause
(
$conn_r
),
$this
->
buildLimitClause
(
$conn_r
));
return
$table
->
loadAllFromArray
(
$rows
);
}
protected
function
willFilterPage
(
array
$backers
)
{
$initiative_phids
=
mpull
(
$backers
,
'getInitiativePHID'
);
$initiatives
=
id
(
new
PhabricatorObjectQuery
())
->
setParentQuery
(
$this
)
->
setViewer
(
$this
->
getViewer
())
->
withPHIDs
(
$initiative_phids
)
->
execute
();
$initiatives
=
mpull
(
$initiatives
,
null
,
'getPHID'
);
foreach
(
$backers
as
$backer
)
{
$initiative_phid
=
$backer
->
getInitiativePHID
();
$initiative
=
idx
(
$initiatives
,
$initiative_phid
);
$backer
->
attachInitiative
(
$initiative
);
}
return
$backers
;
}
private
function
buildWhereClause
(
AphrontDatabaseConnection
$conn_r
)
{
$where
=
array
();
$where
[]
=
$this
->
buildPagingClause
(
$conn_r
);
if
(
$this
->
ids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'id IN (%Ld)'
,
$this
->
ids
);
}
if
(
$this
->
phids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'phid IN (%Ls)'
,
$this
->
phids
);
}
if
(
$this
->
initiativePHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'initiativePHID IN (%Ls)'
,
$this
->
initiativePHIDs
);
}
if
(
$this
->
backerPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'backerPHID IN (%Ls)'
,
$this
->
backerPHIDs
);
}
return
$this
->
formatWhereClause
(
$where
);
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorFundApplication'
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Jul 17, 12:58 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
371064
Default Alt Text
FundBackerQuery.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment