Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F548230
DifferentialSetDiffPropertyConduitAPIMethod.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
DifferentialSetDiffPropertyConduitAPIMethod.php
View Options
<?php
final
class
DifferentialSetDiffPropertyConduitAPIMethod
extends
DifferentialConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'differential.setdiffproperty'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Attach properties to Differential diffs.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'diff_id'
=>
'required diff_id'
,
'name'
=>
'required string'
,
'data'
=>
'required string'
,
);
}
protected
function
defineReturnType
()
{
return
'void'
;
}
protected
function
defineErrorTypes
()
{
return
array
(
'ERR_NOT_FOUND'
=>
pht
(
'Diff was not found.'
),
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$diff_id
=
$request
->
getValue
(
'diff_id'
);
$name
=
$request
->
getValue
(
'name'
);
$data
=
json_decode
(
$request
->
getValue
(
'data'
),
true
);
self
::
updateDiffProperty
(
$diff_id
,
$name
,
$data
);
}
private
static
function
updateDiffProperty
(
$diff_id
,
$name
,
$data
)
{
$property
=
id
(
new
DifferentialDiffProperty
())->
loadOneWhere
(
'diffID = %d AND name = %s'
,
$diff_id
,
$name
);
if
(!
$property
)
{
$property
=
new
DifferentialDiffProperty
();
$property
->
setDiffID
(
$diff_id
);
$property
->
setName
(
$name
);
}
$property
->
setData
(
$data
);
$property
->
save
();
return
$property
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:46 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
103478
Default Alt Text
DifferentialSetDiffPropertyConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment