Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F108905819
DrydockResourceQuery.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 19, 00:53
Size
1014 B
Mime Type
text/x-php
Expires
Mon, Apr 21, 00:53 (2 d)
Engine
blob
Format
Raw Data
Handle
25582326
Attached To
rPH Phabricator
DrydockResourceQuery.php
View Options
<?php
final
class
DrydockResourceQuery
extends
PhabricatorOffsetPagedQuery
{
private
$ids
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
execute
()
{
$table
=
new
DrydockResource
();
$conn_r
=
$table
->
establishConnection
(
'r'
);
$data
=
queryfx_all
(
$conn_r
,
'SELECT resource.* FROM %T resource %Q %Q %Q'
,
$table
->
getTableName
(),
$this
->
buildWhereClause
(
$conn_r
),
$this
->
buildOrderClause
(
$conn_r
),
$this
->
buildLimitClause
(
$conn_r
));
$resources
=
$table
->
loadAllFromArray
(
$data
);
return
$resources
;
}
private
function
buildWhereClause
(
AphrontDatabaseConnection
$conn_r
)
{
$where
=
array
();
if
(
$this
->
ids
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'id IN (%Ld)'
,
$this
->
ids
);
}
return
$this
->
formatWhereClause
(
$where
);
}
private
function
buildOrderClause
(
AphrontDatabaseConnection
$conn_r
)
{
return
qsprintf
(
$conn_r
,
'ORDER BY id DESC'
);
}
}
Event Timeline
Log In to Comment