Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93005787
FundInitiativeIndexer.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, Nov 25, 13:02
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 13:02 (2 d)
Engine
blob
Format
Raw Data
Handle
22556254
Attached To
rPH Phabricator
FundInitiativeIndexer.php
View Options
<?php
final
class
FundInitiativeIndexer
extends
PhabricatorSearchDocumentIndexer
{
public
function
getIndexableObject
()
{
return
new
FundInitiative
();
}
protected
function
loadDocumentByPHID
(
$phid
)
{
$object
=
id
(
new
FundInitiativeQuery
())
->
setViewer
(
$this
->
getViewer
())
->
withPHIDs
(
array
(
$phid
))
->
executeOne
();
if
(!
$object
)
{
throw
new
Exception
(
pht
(
"Unable to load object by PHID '%s'!"
,
$phid
));
}
return
$object
;
}
protected
function
buildAbstractDocumentByPHID
(
$phid
)
{
$initiative
=
$this
->
loadDocumentByPHID
(
$phid
);
$doc
=
id
(
new
PhabricatorSearchAbstractDocument
())
->
setPHID
(
$initiative
->
getPHID
())
->
setDocumentType
(
FundInitiativePHIDType
::
TYPECONST
)
->
setDocumentTitle
(
$initiative
->
getName
())
->
setDocumentCreated
(
$initiative
->
getDateCreated
())
->
setDocumentModified
(
$initiative
->
getDateModified
());
$doc
->
addRelationship
(
PhabricatorSearchRelationship
::
RELATIONSHIP_AUTHOR
,
$initiative
->
getOwnerPHID
(),
PhabricatorPeopleUserPHIDType
::
TYPECONST
,
$initiative
->
getDateCreated
());
$doc
->
addRelationship
(
PhabricatorSearchRelationship
::
RELATIONSHIP_OWNER
,
$initiative
->
getOwnerPHID
(),
PhabricatorPeopleUserPHIDType
::
TYPECONST
,
$initiative
->
getDateCreated
());
$doc
->
addRelationship
(
$initiative
->
isClosed
()
?
PhabricatorSearchRelationship
::
RELATIONSHIP_CLOSED
:
PhabricatorSearchRelationship
::
RELATIONSHIP_OPEN
,
$initiative
->
getPHID
(),
FundInitiativePHIDType
::
TYPECONST
,
time
());
$this
->
indexTransactions
(
$doc
,
new
FundInitiativeTransactionQuery
(),
array
(
$initiative
->
getPHID
()));
return
$doc
;
}
}
Event Timeline
Log In to Comment