1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-27 01:02:42 +01:00

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:
epriestley 2013-09-10 15:31:48 -07:00
parent e8126fa958
commit 5651141520
6 changed files with 18 additions and 25 deletions

View file

@ -686,12 +686,11 @@ phutil_register_library_map(array(
'ManiphestAction' => 'applications/maniphest/constants/ManiphestAction.php',
'ManiphestAuxiliaryFieldDefaultSpecification' => 'applications/maniphest/auxiliaryfield/ManiphestAuxiliaryFieldDefaultSpecification.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',
'ManiphestConstants' => 'applications/maniphest/constants/ManiphestConstants.php',
'ManiphestController' => 'applications/maniphest/controller/ManiphestController.php',
'ManiphestCreateMailReceiver' => 'applications/maniphest/mail/ManiphestCreateMailReceiver.php',
'ManiphestCustomField' => 'applications/maniphest/field/ManiphestCustomField.php',
'ManiphestDAO' => 'applications/maniphest/storage/ManiphestDAO.php',
'ManiphestDefaultTaskExtensions' => 'applications/maniphest/extensions/ManiphestDefaultTaskExtensions.php',
'ManiphestEdgeEventListener' => 'applications/maniphest/event/ManiphestEdgeEventListener.php',
@ -2746,12 +2745,15 @@ phutil_register_library_map(array(
'LiskRawMigrationIterator' => 'PhutilBufferedIterator',
'ManiphestAction' => 'ManiphestConstants',
'ManiphestAuxiliaryFieldDefaultSpecification' => 'ManiphestAuxiliaryFieldSpecification',
'ManiphestAuxiliaryFieldSpecification' => 'PhabricatorMarkupInterface',
'ManiphestAuxiliaryFieldTypeException' => 'Exception',
'ManiphestAuxiliaryFieldValidationException' => 'Exception',
'ManiphestAuxiliaryFieldSpecification' =>
array(
0 => 'ManiphestCustomField',
1 => 'PhabricatorMarkupInterface',
),
'ManiphestBatchEditController' => 'ManiphestController',
'ManiphestController' => 'PhabricatorController',
'ManiphestCreateMailReceiver' => 'PhabricatorMailReceiver',
'ManiphestCustomField' => 'PhabricatorCustomField',
'ManiphestDAO' => 'PhabricatorLiskDAO',
'ManiphestDefaultTaskExtensions' => 'ManiphestTaskExtensions',
'ManiphestEdgeEventListener' => 'PhutilEventListener',

View file

@ -121,7 +121,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
break;
default:
$label = $this->getLabel();
throw new ManiphestAuxiliaryFieldTypeException(
throw new Exception(
"Field type '{$type}' is not a valid type (for field '{$label}').");
break;
}
@ -248,7 +248,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
switch ($this->getFieldType()) {
case self::TYPE_INT:
if ($this->getValue() && !is_numeric($this->getValue())) {
throw new ManiphestAuxiliaryFieldValidationException(
throw new PhabricatorCustomFieldValidationException(
pht(
'%s must be an integer value.',
$this->getLabel()));
@ -262,7 +262,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
return true;
case self::TYPE_DATE:
if ((int)$this->getValue() <= 0 && $this->isRequired()) {
throw new ManiphestAuxiliaryFieldValidationException(
throw new PhabricatorCustomFieldValidationException(
pht(
'%s must be a valid date.',
$this->getLabel()));
@ -271,7 +271,7 @@ class ManiphestAuxiliaryFieldDefaultSpecification
case self::TYPE_USER:
case self::TYPE_USERS:
if (!is_array($this->getValue())) {
throw new ManiphestAuxiliaryFieldValidationException(
throw new PhabricatorCustomFieldValidationException(
pht(
'%s is not a valid list of user PHIDs.',
$this->getLabel()));

View file

@ -4,6 +4,7 @@
* @group maniphest
*/
abstract class ManiphestAuxiliaryFieldSpecification
extends ManiphestCustomField
implements PhabricatorMarkupInterface {
const RENDER_TARGET_HTML = 'html';

View file

@ -1,8 +0,0 @@
<?php
/**
* @group maniphest
*/
final class ManiphestAuxiliaryFieldTypeException extends Exception {
}

View file

@ -1,8 +0,0 @@
<?php
/**
* @group maniphest
*/
final class ManiphestAuxiliaryFieldValidationException extends Exception {
}

View file

@ -0,0 +1,6 @@
<?php
abstract class ManiphestCustomField
extends PhabricatorCustomField {
}