Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97902319
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
Tue, Jan 7, 09:28
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Jan 9, 09:28 (2 d)
Engine
blob
Format
Raw Data
Handle
23436654
Attached To
rPH Phabricator
DrydockResourceQuery.php
View Options
<?php
final
class
DrydockResourceQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$statuses
;
private
$types
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withTypes
(
array
$types
)
{
$this
->
types
=
$types
;
return
$this
;
}
public
function
withStatuses
(
array
$statuses
)
{
$this
->
statuses
=
$statuses
;
return
$this
;
}
public
function
loadPage
()
{
$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
);
}
if
(
$this
->
types
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'type IN (%Ls)'
,
$this
->
types
);
}
if
(
$this
->
statuses
)
{
$where
[]
=
qsprintf
(
$conn_r
,
'status IN (%Ls)'
,
$this
->
statuses
);
}
$where
[]
=
$this
->
buildPagingClause
(
$conn_r
);
return
$this
->
formatWhereClause
(
$where
);
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorApplicationDrydock'
;
}
}
Event Timeline
Log In to Comment