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

Modernize Phortune PHID constants

Summary:
Ref T2787. These were still stuck in the stone ages.

(The handles are pretty skeletal but most aren't used anywehre.)

Test Plan: Funded an initiative without anything breaking. Grepped for removed constants.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2787

Differential Revision: https://secure.phabricator.com/D10647
This commit is contained in:
epriestley 2014-10-06 16:48:16 -07:00
parent 19c1c07d35
commit 61b1fe78c7
16 changed files with 247 additions and 17 deletions

View file

@ -2548,6 +2548,7 @@ phutil_register_library_map(array(
'PholioUploadedImageView' => 'applications/pholio/view/PholioUploadedImageView.php',
'PhortuneAccount' => 'applications/phortune/storage/PhortuneAccount.php',
'PhortuneAccountEditor' => 'applications/phortune/editor/PhortuneAccountEditor.php',
'PhortuneAccountPHIDType' => 'applications/phortune/phid/PhortuneAccountPHIDType.php',
'PhortuneAccountQuery' => 'applications/phortune/query/PhortuneAccountQuery.php',
'PhortuneAccountTransaction' => 'applications/phortune/storage/PhortuneAccountTransaction.php',
'PhortuneAccountTransactionQuery' => 'applications/phortune/query/PhortuneAccountTransactionQuery.php',
@ -2557,9 +2558,11 @@ phutil_register_library_map(array(
'PhortuneCartCheckoutController' => 'applications/phortune/controller/PhortuneCartCheckoutController.php',
'PhortuneCartController' => 'applications/phortune/controller/PhortuneCartController.php',
'PhortuneCartImplementation' => 'applications/phortune/cart/PhortuneCartImplementation.php',
'PhortuneCartPHIDType' => 'applications/phortune/phid/PhortuneCartPHIDType.php',
'PhortuneCartQuery' => 'applications/phortune/query/PhortuneCartQuery.php',
'PhortuneCartViewController' => 'applications/phortune/controller/PhortuneCartViewController.php',
'PhortuneCharge' => 'applications/phortune/storage/PhortuneCharge.php',
'PhortuneChargePHIDType' => 'applications/phortune/phid/PhortuneChargePHIDType.php',
'PhortuneChargeQuery' => 'applications/phortune/query/PhortuneChargeQuery.php',
'PhortuneConstants' => 'applications/phortune/constants/PhortuneConstants.php',
'PhortuneController' => 'applications/phortune/controller/PhortuneController.php',
@ -2578,6 +2581,7 @@ phutil_register_library_map(array(
'PhortunePaymentMethodCreateController' => 'applications/phortune/controller/PhortunePaymentMethodCreateController.php',
'PhortunePaymentMethodDisableController' => 'applications/phortune/controller/PhortunePaymentMethodDisableController.php',
'PhortunePaymentMethodEditController' => 'applications/phortune/controller/PhortunePaymentMethodEditController.php',
'PhortunePaymentMethodPHIDType' => 'applications/phortune/phid/PhortunePaymentMethodPHIDType.php',
'PhortunePaymentMethodQuery' => 'applications/phortune/query/PhortunePaymentMethodQuery.php',
'PhortunePaymentProvider' => 'applications/phortune/provider/PhortunePaymentProvider.php',
'PhortunePaymentProviderTestCase' => 'applications/phortune/provider/__tests__/PhortunePaymentProviderTestCase.php',
@ -2585,10 +2589,12 @@ phutil_register_library_map(array(
'PhortuneProduct' => 'applications/phortune/storage/PhortuneProduct.php',
'PhortuneProductImplementation' => 'applications/phortune/product/PhortuneProductImplementation.php',
'PhortuneProductListController' => 'applications/phortune/controller/PhortuneProductListController.php',
'PhortuneProductPHIDType' => 'applications/phortune/phid/PhortuneProductPHIDType.php',
'PhortuneProductQuery' => 'applications/phortune/query/PhortuneProductQuery.php',
'PhortuneProductViewController' => 'applications/phortune/controller/PhortuneProductViewController.php',
'PhortuneProviderController' => 'applications/phortune/controller/PhortuneProviderController.php',
'PhortunePurchase' => 'applications/phortune/storage/PhortunePurchase.php',
'PhortunePurchasePHIDType' => 'applications/phortune/phid/PhortunePurchasePHIDType.php',
'PhortunePurchaseQuery' => 'applications/phortune/query/PhortunePurchaseQuery.php',
'PhortunePurchaseViewController' => 'applications/phortune/controller/PhortunePurchaseViewController.php',
'PhortuneSchemaSpec' => 'applications/phortune/storage/PhortuneSchemaSpec.php',
@ -5574,6 +5580,7 @@ phutil_register_library_map(array(
'PhabricatorPolicyInterface',
),
'PhortuneAccountEditor' => 'PhabricatorApplicationTransactionEditor',
'PhortuneAccountPHIDType' => 'PhabricatorPHIDType',
'PhortuneAccountQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortuneAccountTransaction' => 'PhabricatorApplicationTransaction',
'PhortuneAccountTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
@ -5585,12 +5592,14 @@ phutil_register_library_map(array(
),
'PhortuneCartCheckoutController' => 'PhortuneCartController',
'PhortuneCartController' => 'PhortuneController',
'PhortuneCartPHIDType' => 'PhabricatorPHIDType',
'PhortuneCartQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortuneCartViewController' => 'PhortuneCartController',
'PhortuneCharge' => array(
'PhortuneDAO',
'PhabricatorPolicyInterface',
),
'PhortuneChargePHIDType' => 'PhabricatorPHIDType',
'PhortuneChargeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortuneController' => 'PhabricatorController',
'PhortuneCurrency' => 'Phobject',
@ -5610,6 +5619,7 @@ phutil_register_library_map(array(
'PhortunePaymentMethodCreateController' => 'PhortuneController',
'PhortunePaymentMethodDisableController' => 'PhortuneController',
'PhortunePaymentMethodEditController' => 'PhortuneController',
'PhortunePaymentMethodPHIDType' => 'PhabricatorPHIDType',
'PhortunePaymentMethodQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortunePaymentProviderTestCase' => 'PhabricatorTestCase',
'PhortunePaypalPaymentProvider' => 'PhortunePaymentProvider',
@ -5618,6 +5628,7 @@ phutil_register_library_map(array(
'PhabricatorPolicyInterface',
),
'PhortuneProductListController' => 'PhabricatorController',
'PhortuneProductPHIDType' => 'PhabricatorPHIDType',
'PhortuneProductQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortuneProductViewController' => 'PhortuneController',
'PhortuneProviderController' => 'PhortuneController',
@ -5625,6 +5636,7 @@ phutil_register_library_map(array(
'PhortuneDAO',
'PhabricatorPolicyInterface',
),
'PhortunePurchasePHIDType' => 'PhabricatorPHIDType',
'PhortunePurchaseQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortunePurchaseViewController' => 'PhortuneController',
'PhortuneSchemaSpec' => 'PhabricatorConfigSchemaSpec',

View file

@ -7,12 +7,6 @@ final class PhabricatorPHIDConstants {
const PHID_TYPE_MAGIC = '!!!!';
const PHID_TYPE_STRY = 'STRY';
const PHID_TYPE_TOBJ = 'TOBJ';
const PHID_TYPE_ACNT = 'ACNT';
const PHID_TYPE_PDCT = 'PDCT';
const PHID_TYPE_PRCH = 'PRCH';
const PHID_TYPE_PAYM = 'PAYM';
const PHID_TYPE_CHRG = 'CHRG';
const PHID_TYPE_CART = 'CART';
const PHID_TYPE_LEGB = 'LEGB';
const PHID_TYPE_XCMT = 'XCMT';

View file

@ -0,0 +1,38 @@
<?php
final class PhortuneAccountPHIDType extends PhabricatorPHIDType {
const TYPECONST = 'ACNT';
public function getTypeName() {
return pht('Phortune Account');
}
public function newObject() {
return new PhortuneAccount();
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhortuneAccountQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$account = $objects[$phid];
$id = $account->getID();
$handle->setName(pht('Account %d', $id));
$handle->setURI("/phortune/{$id}/");
}
}
}

View file

@ -0,0 +1,38 @@
<?php
final class PhortuneCartPHIDType extends PhabricatorPHIDType {
const TYPECONST = 'CART';
public function getTypeName() {
return pht('Phortune Cart');
}
public function newObject() {
return new PhortuneCart();
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhortuneCartQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$cart = $objects[$phid];
$id = $cart->getID();
$handle->setName(pht('Cart %d', $id));
$handle->setURI("/phortune/cart/{$id}/");
}
}
}

View file

@ -0,0 +1,38 @@
<?php
final class PhortuneChargePHIDType extends PhabricatorPHIDType {
const TYPECONST = 'CHRG';
public function getTypeName() {
return pht('Phortune Charge');
}
public function newObject() {
return new PhortuneCharge();
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhortuneChargeQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$charge = $objects[$phid];
$id = $charge->getID();
$handle->setName(pht('Charge %d', $id));
$handle->setURI("/phortune/charge/{$id}/");
}
}
}

View file

@ -0,0 +1,38 @@
<?php
final class PhortunePaymentMethodPHIDType extends PhabricatorPHIDType {
const TYPECONST = 'PAYM';
public function getTypeName() {
return pht('Phortune Payment Method');
}
public function newObject() {
return new PhortunePaymentMethod();
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhortunePaymentMethodQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$method = $objects[$phid];
$id = $method->getID();
$handle->setName(pht('Method %d', $id));
$handle->setURI("/phortune/method/{$id}/");
}
}
}

View file

@ -0,0 +1,38 @@
<?php
final class PhortuneProductPHIDType extends PhabricatorPHIDType {
const TYPECONST = 'PDCT';
public function getTypeName() {
return pht('Phortune Product');
}
public function newObject() {
return new PhortuneProduct();
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhortuneProductQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$product = $objects[$phid];
$id = $product->getID();
$handle->setName(pht('Product %d', $id));
$handle->setURI("/phortune/product/{$id}/");
}
}
}

View file

@ -0,0 +1,38 @@
<?php
final class PhortunePurchasePHIDType extends PhabricatorPHIDType {
const TYPECONST = 'PRCH';
public function getTypeName() {
return pht('Phortune Purchase');
}
public function newObject() {
return new PhortunePurchase();
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
return id(new PhortunePurchaseQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
foreach ($handles as $phid => $handle) {
$purchase = $objects[$phid];
$id = $purchase->getID();
$handle->setName(pht('Purchase %d', $id));
$handle->setURI("/phortune/purchase/{$id}/");
}
}
}

View file

@ -81,7 +81,7 @@ final class PhortuneAccount extends PhortuneDAO
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_ACNT);
PhortuneAccountPHIDType::TYPECONST);
}
public function getMemberPHIDs() {

View file

@ -10,7 +10,7 @@ final class PhortuneAccountTransaction
}
public function getApplicationTransactionType() {
return PhabricatorPHIDConstants::PHID_TYPE_ACNT;
return PhortuneAccountPHIDType::TYPECONST;
}
public function getApplicationTransactionCommentObject() {

View file

@ -160,7 +160,7 @@ final class PhortuneCart extends PhortuneDAO
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_CART);
PhortuneCartPHIDType::TYPECONST);
}
public function attachPurchases(array $purchases) {

View file

@ -58,7 +58,7 @@ final class PhortuneCharge extends PhortuneDAO
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_CHRG);
PhortuneChargePHIDType::TYPECONST);
}
public function getMetadataValue($key, $default = null) {

View file

@ -48,7 +48,7 @@ final class PhortunePaymentMethod extends PhortuneDAO
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_PAYM);
PhortunePaymentMethodPHIDType::TYPECONST);
}
public function attachAccount(PhortuneAccount $account) {

View file

@ -37,7 +37,7 @@ final class PhortuneProduct extends PhortuneDAO
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_PDCT);
PhortuneProductPHIDType::TYPECONST);
}
public static function initializeNewProduct() {

View file

@ -60,8 +60,7 @@ final class PhortunePurchase extends PhortuneDAO
}
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
PhabricatorPHIDConstants::PHID_TYPE_PRCH);
return PhabricatorPHID::generateNewPHID(PhortuneChargePHIDType::TYPECONST);
}
public function attachCart(PhortuneCart $cart) {

View file

@ -227,9 +227,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
static $class_map = array(
PhabricatorPHIDConstants::PHID_TYPE_TOBJ => 'HarbormasterObject',
PhabricatorPHIDConstants::PHID_TYPE_ACNT => 'PhortuneAccount',
PhabricatorPHIDConstants::PHID_TYPE_PRCH => 'PhortunePurchase',
PhabricatorPHIDConstants::PHID_TYPE_CHRG => 'PhortuneCharge',
PhabricatorPHIDConstants::PHID_TYPE_XOBJ => 'DoorkeeperExternalObject',
);