Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F946936
DrydockCommandQuery.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
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
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jun 17, 11:57 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
223360
Default Alt Text
DrydockCommandQuery.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment