Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92653302
PHIDLookupConduitAPIMethod.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
Fri, Nov 22, 10:17
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Nov 24, 10:17 (2 d)
Engine
blob
Format
Raw Data
Handle
22479369
Attached To
rPH Phabricator
PHIDLookupConduitAPIMethod.php
View Options
<?php
final
class
PHIDLookupConduitAPIMethod
extends
PHIDConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'phid.lookup'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Look up objects by name.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'names'
=>
'required list<string>'
,
);
}
protected
function
defineReturnType
()
{
return
'nonempty dict<string, wild>'
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$names
=
$request
->
getValue
(
'names'
);
$query
=
id
(
new
PhabricatorObjectQuery
())
->
setViewer
(
$request
->
getUser
())
->
withNames
(
$names
);
$query
->
execute
();
$name_map
=
$query
->
getNamedResults
();
$handles
=
id
(
new
PhabricatorHandleQuery
())
->
setViewer
(
$request
->
getUser
())
->
withPHIDs
(
mpull
(
$name_map
,
'getPHID'
))
->
execute
();
$result
=
array
();
foreach
(
$name_map
as
$name
=>
$object
)
{
$phid
=
$object
->
getPHID
();
$handle
=
$handles
[
$phid
];
$result
[
$name
]
=
$this
->
buildHandleInformationDictionary
(
$handle
);
}
return
$result
;
}
}
Event Timeline
Log In to Comment