Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98303327
DrydockCommandQuery.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, Jan 11, 22:17
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Jan 13, 22:17 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
23555701
Attached To
rPH Phabricator
DrydockCommandQuery.php
View Options
<?php
final
class
DrydockCommandQuery
extends
DrydockQuery
{
private
$ids
;
private
$targetPHIDs
;
private
$consumed
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withTargetPHIDs
(
array
$phids
)
{
$this
->
targetPHIDs
=
$phids
;
return
$this
;
}
public
function
withConsumed
(
$consumed
)
{
$this
->
consumed
=
$consumed
;
return
$this
;
}
public
function
newResultObject
()
{
return
new
DrydockCommand
();
}
protected
function
loadPage
()
{
return
$this
->
loadStandardPage
(
$this
->
newResultObject
());
}
protected
function
willFilterPage
(
array
$commands
)
{
$target_phids
=
mpull
(
$commands
,
'getTargetPHID'
);
$targets
=
id
(
new
PhabricatorObjectQuery
())
->
setViewer
(
$this
->
getViewer
())
->
setParentQuery
(
$this
)
->
withPHIDs
(
$target_phids
)
->
execute
();
$targets
=
mpull
(
$targets
,
null
,
'getPHID'
);
foreach
(
$commands
as
$key
=>
$command
)
{
$target
=
idx
(
$targets
,
$command
->
getTargetPHID
());
if
(!
$target
)
{
$this
->
didRejectResult
(
$command
);
unset
(
$commands
[
$key
]);
continue
;
}
$command
->
attachCommandTarget
(
$target
);
}
return
$commands
;
}
protected
function
buildWhereClauseParts
(
AphrontDatabaseConnection
$conn
)
{
$where
=
parent
::
buildWhereClauseParts
(
$conn
);
if
(
$this
->
ids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'id IN (%Ld)'
,
$this
->
ids
);
}
if
(
$this
->
targetPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'targetPHID IN (%Ls)'
,
$this
->
targetPHIDs
);
}
if
(
$this
->
consumed
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'isConsumed = %d'
,
(
int
)
$this
->
consumed
);
}
return
$where
;
}
}
Event Timeline
Log In to Comment