Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F546421
PhabricatorSubscribersQuery.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
PhabricatorSubscribersQuery.php
View Options
<?php
final
class
PhabricatorSubscribersQuery
extends
PhabricatorQuery
{
private
$objectPHIDs
;
private
$subscriberPHIDs
;
public
static
function
loadSubscribersForPHID
(
$phid
)
{
if
(!
$phid
)
{
return
array
();
}
$subscribers
=
id
(
new
PhabricatorSubscribersQuery
())
->
withObjectPHIDs
(
array
(
$phid
))
->
execute
();
return
$subscribers
[
$phid
];
}
public
function
withObjectPHIDs
(
array
$object_phids
)
{
$this
->
objectPHIDs
=
$object_phids
;
return
$this
;
}
public
function
withSubscriberPHIDs
(
array
$subscriber_phids
)
{
$this
->
subscriberPHIDs
=
$subscriber_phids
;
return
$this
;
}
public
function
execute
()
{
$query
=
new
PhabricatorEdgeQuery
();
$edge_type
=
PhabricatorObjectHasSubscriberEdgeType
::
EDGECONST
;
$query
->
withSourcePHIDs
(
$this
->
objectPHIDs
);
$query
->
withEdgeTypes
(
array
(
$edge_type
));
if
(
$this
->
subscriberPHIDs
)
{
$query
->
withDestinationPHIDs
(
$this
->
subscriberPHIDs
);
}
$edges
=
$query
->
execute
();
$results
=
array_fill_keys
(
$this
->
objectPHIDs
,
array
());
foreach
(
$edges
as
$src
=>
$edge_types
)
{
foreach
(
$edge_types
[
$edge_type
]
as
$dst
=>
$data
)
{
$results
[
$src
][]
=
$dst
;
}
}
return
$results
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 1:14 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
97630
Default Alt Text
PhabricatorSubscribersQuery.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment