Page MenuHomePhabricator
Paste P1748

Get CustomField for Project
ActivePublic

Authored by devurandom on Apr 1 2015, 3:27 PM.
Tags
None
Referenced Files
F355943: Get_CustomField_for_Project
Apr 1 2015, 3:46 PM
F355929: Get_CustomField_for_Project
Apr 1 2015, 3:27 PM
Subscribers
None
function getField($object, $id, $user) {
$fields = PhabricatorCustomField::getObjectFields($object, PhabricatorCustomField::ROLE_VIEW)
->setViewer($user)
->readFieldsFromStorage($object)
->getFields();
$field = $fields[$id]
->getProxy()
->getFieldValue();
return $field;
}
$projects = id(new PhabricatorProjectQuery())
->setViewer($admin)
->execute();
foreach ($projects as $project) {
print("proj: " . $project->getName() . "\n");
$ldap_dn = getField($project, "std:project:test", $admin);
print(" std:project:test = " . $ldap_dn . "\n");
}

Event Timeline

devurandom changed the title of this paste from untitled to Get CustomField for Project.
devurandom updated the paste's language from autodetect to php.