Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93859443
ManiphestTaskParentTransaction.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
Mon, Dec 2, 01:56
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 4, 01:56 (1 d, 21 h)
Engine
blob
Format
Raw Data
Handle
22715561
Attached To
rPH Phabricator
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
;
}
}
Event Timeline
Log In to Comment