Make Maniphest custom fields extend PhabricatorCustomField
Summary: Ref T418. These implementations share no method names, so we can safely just move Maniphest fields into the `PhabricatorCustomField` hierarchy. Replaces two Maniphest-specific custom field exceptions which nothing catches. Test Plan: Viewed Maniphest, edited/altered custom fields. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T418 Differential Revision: https://secure.phabricator.com/D6927
This commit is contained in:
parent
e8126fa958
commit
5651141520
|
@ -686,12 +686,11 @@ phutil_register_library_map(array(
|
||||||
'ManiphestAction' => 'applications/maniphest/constants/ManiphestAction.php',
|
'ManiphestAction' => 'applications/maniphest/constants/ManiphestAction.php',
|
||||||
'ManiphestAuxiliaryFieldDefaultSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php',
|
'ManiphestAuxiliaryFieldDefaultSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.php',
|
||||||
'ManiphestAuxiliaryFieldSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php',
|
'ManiphestAuxiliaryFieldSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldSpecification.php',
|
||||||
'ManiphestAuxiliaryFieldTypeException' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldTypeException.php',
|
|
||||||
'ManiphestAuxiliaryFieldValidationException' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldValidationException.php',
|
|
||||||
'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php',
|
'ManiphestBatchEditController' => 'applications/maniphest/controller/ManiphestBatchEditController.php',
|
||||||
'ManiphestConstants' => 'applications/maniphest/constants/ManiphestConstants.php',
|
'ManiphestConstants' => 'applications/maniphest/constants/ManiphestConstants.php',
|
||||||
'ManiphestController' => 'applications/maniphest/controller/ManiphestController.php',
|
'ManiphestController' => 'applications/maniphest/controller/ManiphestController.php',
|
||||||
'ManiphestCreateMailReceiver' => 'applications/maniphest/mail/ManiphestCreateMailReceiver.php',
|
'ManiphestCreateMailReceiver' => 'applications/maniphest/mail/ManiphestCreateMailReceiver.php',
|
||||||
|
'ManiphestCustomField' => 'applications/maniphest/field/ManiphestCustomField.php',
|
||||||
'ManiphestDAO' => 'applications/maniphest/storage/ManiphestDAO.php',
|
'ManiphestDAO' => 'applications/maniphest/storage/ManiphestDAO.php',
|
||||||
'ManiphestDefaultTaskExtensions' => 'applications/maniphest/extensions/ManiphestDefaultTaskExtensions.php',
|
'ManiphestDefaultTaskExtensions' => 'applications/maniphest/extensions/ManiphestDefaultTaskExtensions.php',
|
||||||
'ManiphestEdgeEventListener' => 'applications/maniphest/event/ManiphestEdgeEventListener.php',
|
'ManiphestEdgeEventListener' => 'applications/maniphest/event/ManiphestEdgeEventListener.php',
|
||||||
|
@ -2746,12 +2745,15 @@ phutil_register_library_map(array(
|
||||||
'LiskRawMigrationIterator' => 'PhutilBufferedIterator',
|
'LiskRawMigrationIterator' => 'PhutilBufferedIterator',
|
||||||
'ManiphestAction' => 'ManiphestConstants',
|
'ManiphestAction' => 'ManiphestConstants',
|
||||||
'ManiphestAuxiliaryFieldDefaultSpecification' => 'ManiphestAuxiliaryFieldSpecification',
|
'ManiphestAuxiliaryFieldDefaultSpecification' => 'ManiphestAuxiliaryFieldSpecification',
|
||||||
'ManiphestAuxiliaryFieldSpecification' => 'PhabricatorMarkupInterface',
|
'ManiphestAuxiliaryFieldSpecification' =>
|
||||||
'ManiphestAuxiliaryFieldTypeException' => 'Exception',
|
array(
|
||||||
'ManiphestAuxiliaryFieldValidationException' => 'Exception',
|
0 => 'ManiphestCustomField',
|
||||||
|
1 => 'PhabricatorMarkupInterface',
|
||||||
|
),
|
||||||
'ManiphestBatchEditController' => 'ManiphestController',
|
'ManiphestBatchEditController' => 'ManiphestController',
|
||||||
'ManiphestController' => 'PhabricatorController',
|
'ManiphestController' => 'PhabricatorController',
|
||||||
'ManiphestCreateMailReceiver' => 'PhabricatorMailReceiver',
|
'ManiphestCreateMailReceiver' => 'PhabricatorMailReceiver',
|
||||||
|
'ManiphestCustomField' => 'PhabricatorCustomField',
|
||||||
'ManiphestDAO' => 'PhabricatorLiskDAO',
|
'ManiphestDAO' => 'PhabricatorLiskDAO',
|
||||||
'ManiphestDefaultTaskExtensions' => 'ManiphestTaskExtensions',
|
'ManiphestDefaultTaskExtensions' => 'ManiphestTaskExtensions',
|
||||||
'ManiphestEdgeEventListener' => 'PhutilEventListener',
|
'ManiphestEdgeEventListener' => 'PhutilEventListener',
|
||||||
|
|
|
@ -121,7 +121,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$label = $this->getLabel();
|
$label = $this->getLabel();
|
||||||
throw new ManiphestAuxiliaryFieldTypeException(
|
throw new Exception(
|
||||||
"Field type '{$type}' is not a valid type (for field '{$label}').");
|
"Field type '{$type}' is not a valid type (for field '{$label}').");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
|
||||||
switch ($this->getFieldType()) {
|
switch ($this->getFieldType()) {
|
||||||
case self::TYPE_INT:
|
case self::TYPE_INT:
|
||||||
if ($this->getValue() && !is_numeric($this->getValue())) {
|
if ($this->getValue() && !is_numeric($this->getValue())) {
|
||||||
throw new ManiphestAuxiliaryFieldValidationException(
|
throw new PhabricatorCustomFieldValidationException(
|
||||||
pht(
|
pht(
|
||||||
'%s must be an integer value.',
|
'%s must be an integer value.',
|
||||||
$this->getLabel()));
|
$this->getLabel()));
|
||||||
|
@ -262,7 +262,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
|
||||||
return true;
|
return true;
|
||||||
case self::TYPE_DATE:
|
case self::TYPE_DATE:
|
||||||
if ((int)$this->getValue() <= 0 && $this->isRequired()) {
|
if ((int)$this->getValue() <= 0 && $this->isRequired()) {
|
||||||
throw new ManiphestAuxiliaryFieldValidationException(
|
throw new PhabricatorCustomFieldValidationException(
|
||||||
pht(
|
pht(
|
||||||
'%s must be a valid date.',
|
'%s must be a valid date.',
|
||||||
$this->getLabel()));
|
$this->getLabel()));
|
||||||
|
@ -271,7 +271,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
|
||||||
case self::TYPE_USER:
|
case self::TYPE_USER:
|
||||||
case self::TYPE_USERS:
|
case self::TYPE_USERS:
|
||||||
if (!is_array($this->getValue())) {
|
if (!is_array($this->getValue())) {
|
||||||
throw new ManiphestAuxiliaryFieldValidationException(
|
throw new PhabricatorCustomFieldValidationException(
|
||||||
pht(
|
pht(
|
||||||
'%s is not a valid list of user PHIDs.',
|
'%s is not a valid list of user PHIDs.',
|
||||||
$this->getLabel()));
|
$this->getLabel()));
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* @group maniphest
|
* @group maniphest
|
||||||
*/
|
*/
|
||||||
abstract class ManiphestAuxiliaryFieldSpecification
|
abstract class ManiphestAuxiliaryFieldSpecification
|
||||||
|
extends ManiphestCustomField
|
||||||
implements PhabricatorMarkupInterface {
|
implements PhabricatorMarkupInterface {
|
||||||
|
|
||||||
const RENDER_TARGET_HTML = 'html';
|
const RENDER_TARGET_HTML = 'html';
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group maniphest
|
|
||||||
*/
|
|
||||||
final class ManiphestAuxiliaryFieldTypeException extends Exception {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @group maniphest
|
|
||||||
*/
|
|
||||||
final class ManiphestAuxiliaryFieldValidationException extends Exception {
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class ManiphestCustomField
|
||||||
|
extends PhabricatorCustomField {
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue