1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-27 16:00:59 +01:00

Added a method on FieldSpec to get all diff properties

Summary: We need to be able to query for all properties matching a given pattern, as mentioned in D3676

Test Plan: Loaded Phabricator, ensured diff loaded, ensured field using all properties was able to enumerate them.

Reviewers: vrana, epriestley

Reviewed By: vrana

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3679
This commit is contained in:
Roy Williams 2012-10-10 16:54:08 -07:00
parent efed12400d
commit 8007d53473

View file

@ -893,6 +893,22 @@ abstract class DifferentialFieldSpecification {
return $this->handles[$phid];
}
/**
* Get the list of properties for a diff set by @{method:setManualDiff}.
*
* @return array Array of all Diff properties.
* @task context
*/
final public function getDiffProperties() {
if ($this->diffProperties === null) {
// This will be set to some (possibly empty) array if we've loaded
// properties, so null means diff properties aren't available in this
// context.
throw new DifferentialFieldDataNotAvailableException($this);
}
return $this->diffProperties;
}
/**
* Get a property of a diff set by @{method:setManualDiff}.
*
@ -902,13 +918,7 @@ abstract class DifferentialFieldSpecification {
* @task context
*/
final public function getDiffProperty($key) {
if ($this->diffProperties === null) {
// This will be set to some (possibly empty) array if we've loaded
// properties, so null means diff properties aren't available in this
// context.
throw new DifferentialFieldDataNotAvailableException($this);
}
return idx($this->diffProperties, $key);
return idx($this->getDiffProperties(), $key);
}
}