Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F111288342
HarbormasterBuildStepQuery.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
Wed, Apr 30, 14:38
Size
1 KB
Mime Type
text/x-php
Expires
Fri, May 2, 14:38 (2 d)
Engine
blob
Format
Raw Data
Handle
25903531
Attached To
rPH Phabricator
HarbormasterBuildStepQuery.php
View Options
<?php
final
class
HarbormasterBuildStepQuery
extends
PhabricatorCursorPagedPolicyAwareQuery
{
private
$ids
;
private
$phids
;
private
$buildPlanPHIDs
;
public
function
withIDs
(
array
$ids
)
{
$this
->
ids
=
$ids
;
return
$this
;
}
public
function
withPHIDs
(
array
$phids
)
{
$this
->
phids
=
$phids
;
return
$this
;
}
public
function
withBuildPlanPHIDs
(
array
$phids
)
{
$this
->
buildPlanPHIDs
=
$phids
;
return
$this
;
}
public
function
newResultObject
()
{
return
new
HarbormasterBuildStep
();
}
protected
function
loadPage
()
{
return
$this
->
loadStandardPage
(
$this
->
newResultObject
());
}
protected
function
buildWhereClauseParts
(
AphrontDatabaseConnection
$conn
)
{
$where
=
parent
::
buildWhereClauseParts
(
$conn
);
if
(
$this
->
ids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'id IN (%Ld)'
,
$this
->
ids
);
}
if
(
$this
->
phids
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'phid in (%Ls)'
,
$this
->
phids
);
}
if
(
$this
->
buildPlanPHIDs
!==
null
)
{
$where
[]
=
qsprintf
(
$conn
,
'buildPlanPHID in (%Ls)'
,
$this
->
buildPlanPHIDs
);
}
return
$where
;
}
protected
function
willFilterPage
(
array
$page
)
{
$plans
=
array
();
$buildplan_phids
=
array_filter
(
mpull
(
$page
,
'getBuildPlanPHID'
));
if
(
$buildplan_phids
)
{
$plans
=
id
(
new
PhabricatorObjectQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withPHIDs
(
$buildplan_phids
)
->
setParentQuery
(
$this
)
->
execute
();
$plans
=
mpull
(
$plans
,
null
,
'getPHID'
);
}
foreach
(
$page
as
$key
=>
$build
)
{
$buildable_phid
=
$build
->
getBuildPlanPHID
();
if
(
empty
(
$plans
[
$buildable_phid
]))
{
unset
(
$page
[
$key
]);
continue
;
}
$build
->
attachBuildPlan
(
$plans
[
$buildable_phid
]);
}
return
$page
;
}
public
function
getQueryApplicationClass
()
{
return
'PhabricatorHarbormasterApplication'
;
}
}
Event Timeline
Log In to Comment