Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F557520
ManiphestTaskParentTransaction.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
ManiphestTaskParentTransaction.php
View Options
<?php
final
class
ManiphestTaskParentTransaction
extends
ManiphestTaskTransactionType
{
const
TRANSACTIONTYPE
=
'parent'
;
public
function
generateOldValue
(
$object
)
{
return
null
;
}
public
function
shouldHide
()
{
return
true
;
}
public
function
applyExternalEffects
(
$object
,
$value
)
{
$parent_phid
=
$value
;
$parent_type
=
ManiphestTaskDependsOnTaskEdgeType
::
EDGECONST
;
$task_phid
=
$object
->
getPHID
();
id
(
new
PhabricatorEdgeEditor
())
->
addEdge
(
$parent_phid
,
$parent_type
,
$task_phid
)
->
save
();
}
public
function
validateTransactions
(
$object
,
array
$xactions
)
{
$errors
=
array
();
$with_effect
=
array
();
foreach
(
$xactions
as
$xaction
)
{
$task_phid
=
$xaction
->
getNewValue
();
if
(!
$task_phid
)
{
continue
;
}
$with_effect
[]
=
$xaction
;
$task
=
id
(
new
ManiphestTaskQuery
())
->
setViewer
(
$this
->
getActor
())
->
withPHIDs
(
array
(
$task_phid
))
->
executeOne
();
if
(!
$task
)
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'Parent task identifier "%s" does not identify a visible '
.
'task.'
,
$task_phid
));
}
}
if
(
$with_effect
&&
!
$this
->
isNewObject
())
{
$errors
[]
=
$this
->
newInvalidError
(
pht
(
'You can only select a parent task when creating a '
.
'transaction for the first time.'
));
}
return
$errors
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 8:15 PM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
114040
Default Alt Text
ManiphestTaskParentTransaction.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment