2013-05-18 11:46:39 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group project
|
|
|
|
*/
|
|
|
|
final class ProjectRemarkupRule
|
|
|
|
extends PhabricatorRemarkupRuleObject {
|
|
|
|
|
|
|
|
protected function getObjectNamePrefix() {
|
|
|
|
return '#';
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getObjectIDPattern() {
|
2014-01-03 21:24:21 +01:00
|
|
|
return
|
|
|
|
PhabricatorProjectPHIDTypeProject::getProjectMonogramPatternFragment();
|
2013-05-18 11:46:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
protected function loadObjects(array $ids) {
|
|
|
|
$viewer = $this->getEngine()->getConfig('viewer');
|
|
|
|
|
2014-01-03 21:24:21 +01:00
|
|
|
// Put the "#" back on the front of these IDs.
|
|
|
|
$names = array();
|
|
|
|
foreach ($ids as $id) {
|
|
|
|
$names[] = '#'.$id;
|
2013-05-18 11:46:39 +02:00
|
|
|
}
|
|
|
|
|
2014-01-03 21:24:21 +01:00
|
|
|
// Issue a query by object name.
|
|
|
|
$query = id(new PhabricatorObjectQuery())
|
2013-05-18 11:46:39 +02:00
|
|
|
->setViewer($viewer)
|
2014-01-03 21:24:21 +01:00
|
|
|
->withNames($names);
|
|
|
|
|
|
|
|
$query->execute();
|
|
|
|
$projects = $query->getNamedResults();
|
2013-05-18 11:46:39 +02:00
|
|
|
|
2014-01-03 21:24:21 +01:00
|
|
|
// Slice the "#" off again.
|
2013-05-18 11:46:39 +02:00
|
|
|
$result = array();
|
2014-01-03 21:24:21 +01:00
|
|
|
foreach ($projects as $name => $project) {
|
|
|
|
$result[substr($name, 1)] = $project;
|
2013-05-18 11:46:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|