Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F546201
ManiphestTaskRelationship.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
ManiphestTaskRelationship.php
View Options
<?php
abstract
class
ManiphestTaskRelationship
extends
PhabricatorObjectRelationship
{
public
function
isEnabledForObject
(
$object
)
{
$viewer
=
$this
->
getViewer
();
$has_app
=
PhabricatorApplication
::
isClassInstalledForViewer
(
'PhabricatorManiphestApplication'
,
$viewer
);
if
(!
$has_app
)
{
return
false
;
}
return
(
$object
instanceof
ManiphestTask
);
}
protected
function
newMergeIntoTransactions
(
ManiphestTask
$task
)
{
return
array
(
id
(
new
ManiphestTransaction
())
->
setTransactionType
(
ManiphestTaskMergedIntoTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
$task
->
getPHID
()),
);
}
protected
function
newMergeFromTransactions
(
array
$tasks
)
{
$xactions
=
array
();
$subscriber_phids
=
$this
->
loadMergeSubscriberPHIDs
(
$tasks
);
$xactions
[]
=
id
(
new
ManiphestTransaction
())
->
setTransactionType
(
ManiphestTaskMergedFromTransaction
::
TRANSACTIONTYPE
)
->
setNewValue
(
mpull
(
$tasks
,
'getPHID'
));
$xactions
[]
=
id
(
new
ManiphestTransaction
())
->
setTransactionType
(
PhabricatorTransactions
::
TYPE_SUBSCRIBERS
)
->
setNewValue
(
array
(
'+'
=>
$subscriber_phids
));
return
$xactions
;
}
private
function
loadMergeSubscriberPHIDs
(
array
$tasks
)
{
$phids
=
array
();
foreach
(
$tasks
as
$task
)
{
$phids
[]
=
$task
->
getAuthorPHID
();
$phids
[]
=
$task
->
getOwnerPHID
();
}
$subscribers
=
id
(
new
PhabricatorSubscribersQuery
())
->
withObjectPHIDs
(
mpull
(
$tasks
,
'getPHID'
))
->
execute
();
foreach
(
$subscribers
as
$phid
=>
$subscriber_list
)
{
foreach
(
$subscriber_list
as
$subscriber
)
{
$phids
[]
=
$subscriber
;
}
}
$phids
=
array_unique
(
$phids
);
$phids
=
array_filter
(
$phids
);
return
$phids
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:09 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
122144
Default Alt Text
ManiphestTaskRelationship.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment