Differential D20417 Diff 48761 src/applications/project/trigger/PhabricatorProjectTriggerManiphestStatusRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerManiphestStatusRule.php
| <?php | <?php | ||||
| final class PhabricatorProjectTriggerManiphestStatusRule | final class PhabricatorProjectTriggerManiphestStatusRule | ||||
| extends PhabricatorProjectTriggerRule { | extends PhabricatorProjectTriggerRule { | ||||
| const TRIGGERTYPE = 'task.status'; | const TRIGGERTYPE = 'task.status'; | ||||
| public function getSelectControlName() { | public function getSelectControlName() { | ||||
| return pht('Change status to'); | return pht('Change status to'); | ||||
| } | } | ||||
| protected function assertValidRuleValue($value) { | protected function assertValidRuleRecordFormat($value) { | ||||
| if (!is_string($value)) { | if (!is_string($value)) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Status rule value should be a string, but is not (value is "%s").', | 'Status rule value should be a string, but is not (value is "%s").', | ||||
| phutil_describe_type($value))); | phutil_describe_type($value))); | ||||
| } | } | ||||
| } | |||||
| protected function assertValidRuleRecordValue($value) { | |||||
| $map = ManiphestTaskStatus::getTaskStatusMap(); | $map = ManiphestTaskStatus::getTaskStatusMap(); | ||||
| if (!isset($map[$value])) { | if (!isset($map[$value])) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Rule value ("%s") is not a valid task status.', | 'Task status value ("%s") is not a valid task status. '. | ||||
| $value)); | 'Valid statues are: %s.', | ||||
| $value, | |||||
| implode(', ', array_keys($map)))); | |||||
| } | } | ||||
| } | } | ||||
| protected function newDropTransactions($object, $value) { | protected function newDropTransactions($object, $value) { | ||||
| return array( | return array( | ||||
| $this->newTransaction() | $this->newTransaction() | ||||
| ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE) | ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE) | ||||
| ->setNewValue($value), | ->setNewValue($value), | ||||
| ▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines | |||||