Details
Details
How to use PHP to query Maniphest Tasks by a custom field?
I expect something like this:
$custom_field_name = 'custom:zabbix.trigger.id'; $condition_value = 123; $task = ( new ManiphestTransactionQuery() ) ->setViewer( $viewer ) ->setConditionByCustomFieldButWhatIsTheNameOfThisMethod( $custom_field_name, $condition_value ) ->executeOne();
Thanks for any tip. I'm writing a small extension and I need to find a Task by a custom value.
Answers
Answers
Got this to work, using a Standard custom field:
$engine = new ManiphestTaskSearchEngine(); $task = new ManiphestTask(); $field_key = 'std:maniphest:custom-list.hours'; $field = PhabricatorCustomField::getObjectField( $task, PhabricatorCustomField::ROLE_APPLICATIONSEARCH, $field_key); $query_value = '222'; $query = ($engine->newQuery()) ->setViewer($viewer); $field->applyApplicationSearchConstraintToQuery( $engine, $query, $query_value); $res = $query->executeOne(); echo(pht("Found task with id: %d \n", $res->getID()));
New Answer
New Answer