Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F584214
HarbormasterQueryBuildablesConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
HarbormasterQueryBuildablesConduitAPIMethod.php
View Options
<?php
final
class
HarbormasterQueryBuildablesConduitAPIMethod
extends
HarbormasterConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'harbormaster.querybuildables'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Query Harbormaster buildables.'
);
}
public
function
defineParamTypes
()
{
return
array
(
'ids'
=>
'optional list<id>'
,
'phids'
=>
'optional list<phid>'
,
'buildablePHIDs'
=>
'optional list<phid>'
,
'containerPHIDs'
=>
'optional list<phid>'
,
'manualBuildables'
=>
'optional bool'
,
)
+
self
::
getPagerParamTypes
();
}
public
function
defineReturnType
()
{
return
'wild'
;
}
public
function
defineErrorTypes
()
{
return
array
();
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$viewer
=
$request
->
getUser
();
$query
=
id
(
new
HarbormasterBuildableQuery
())
->
setViewer
(
$viewer
);
$ids
=
$request
->
getValue
(
'ids'
);
if
(
$ids
!==
null
)
{
$query
->
withIDs
(
$ids
);
}
$phids
=
$request
->
getValue
(
'phids'
);
if
(
$phids
!==
null
)
{
$query
->
withPHIDs
(
$phids
);
}
$buildable_phids
=
$request
->
getValue
(
'buildablePHIDs'
);
if
(
$buildable_phids
!==
null
)
{
$query
->
withBuildablePHIDs
(
$buildable_phids
);
}
$container_phids
=
$request
->
getValue
(
'containerPHIDs'
);
if
(
$container_phids
!==
null
)
{
$query
->
withContainerPHIDs
(
$container_phids
);
}
$manual
=
$request
->
getValue
(
'manualBuildables'
);
if
(
$manual
!==
null
)
{
$query
->
withManualBuildables
(
$manual
);
}
$pager
=
$this
->
newPager
(
$request
);
$buildables
=
$query
->
executeWithCursorPager
(
$pager
);
$data
=
array
();
foreach
(
$buildables
as
$buildable
)
{
$monogram
=
$buildable
->
getMonogram
();
$status
=
$buildable
->
getBuildableStatus
();
$status_name
=
HarbormasterBuildable
::
getBuildableStatusName
(
$status
);
$data
[]
=
array
(
'id'
=>
$buildable
->
getID
(),
'phid'
=>
$buildable
->
getPHID
(),
'monogram'
=>
$monogram
,
'uri'
=>
PhabricatorEnv
::
getProductionURI
(
'/'
.
$monogram
),
'buildableStatus'
=>
$status
,
'buildableStatusName'
=>
$status_name
,
'buildablePHID'
=>
$buildable
->
getBuildablePHID
(),
'containerPHID'
=>
$buildable
->
getContainerPHID
(),
'isManualBuildable'
=>
(
bool
)
$buildable
->
getIsManualBuildable
(),
);
}
$results
=
array
(
'data'
=>
$data
,
);
$results
=
$this
->
addPagerResults
(
$results
,
$pager
);
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, May 14, 12:47 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
131029
Default Alt Text
HarbormasterQueryBuildablesConduitAPIMethod.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment