Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14747892
D10647.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
16 KB
Referenced Files
None
Subscribers
None
D10647.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2548,6 +2548,7 @@
'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 @@
'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 @@
'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 @@
'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 @@
'PhabricatorPolicyInterface',
),
'PhortuneAccountEditor' => 'PhabricatorApplicationTransactionEditor',
+ 'PhortuneAccountPHIDType' => 'PhabricatorPHIDType',
'PhortuneAccountQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortuneAccountTransaction' => 'PhabricatorApplicationTransaction',
'PhortuneAccountTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
@@ -5585,12 +5592,14 @@
),
'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 @@
'PhortunePaymentMethodCreateController' => 'PhortuneController',
'PhortunePaymentMethodDisableController' => 'PhortuneController',
'PhortunePaymentMethodEditController' => 'PhortuneController',
+ 'PhortunePaymentMethodPHIDType' => 'PhabricatorPHIDType',
'PhortunePaymentMethodQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortunePaymentProviderTestCase' => 'PhabricatorTestCase',
'PhortunePaypalPaymentProvider' => 'PhortunePaymentProvider',
@@ -5618,6 +5628,7 @@
'PhabricatorPolicyInterface',
),
'PhortuneProductListController' => 'PhabricatorController',
+ 'PhortuneProductPHIDType' => 'PhabricatorPHIDType',
'PhortuneProductQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortuneProductViewController' => 'PhortuneController',
'PhortuneProviderController' => 'PhortuneController',
@@ -5625,6 +5636,7 @@
'PhortuneDAO',
'PhabricatorPolicyInterface',
),
+ 'PhortunePurchasePHIDType' => 'PhabricatorPHIDType',
'PhortunePurchaseQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhortunePurchaseViewController' => 'PhortuneController',
'PhortuneSchemaSpec' => 'PhabricatorConfigSchemaSpec',
diff --git a/src/applications/phid/PhabricatorPHIDConstants.php b/src/applications/phid/PhabricatorPHIDConstants.php
--- a/src/applications/phid/PhabricatorPHIDConstants.php
+++ b/src/applications/phid/PhabricatorPHIDConstants.php
@@ -7,12 +7,6 @@
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';
diff --git a/src/applications/phortune/phid/PhortuneAccountPHIDType.php b/src/applications/phortune/phid/PhortuneAccountPHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/phid/PhortuneAccountPHIDType.php
@@ -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}/");
+ }
+ }
+
+}
diff --git a/src/applications/phortune/phid/PhortuneCartPHIDType.php b/src/applications/phortune/phid/PhortuneCartPHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/phid/PhortuneCartPHIDType.php
@@ -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}/");
+ }
+ }
+
+}
diff --git a/src/applications/phortune/phid/PhortuneChargePHIDType.php b/src/applications/phortune/phid/PhortuneChargePHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/phid/PhortuneChargePHIDType.php
@@ -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}/");
+ }
+ }
+
+}
diff --git a/src/applications/phortune/phid/PhortunePaymentMethodPHIDType.php b/src/applications/phortune/phid/PhortunePaymentMethodPHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/phid/PhortunePaymentMethodPHIDType.php
@@ -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}/");
+ }
+ }
+
+}
diff --git a/src/applications/phortune/phid/PhortuneProductPHIDType.php b/src/applications/phortune/phid/PhortuneProductPHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/phid/PhortuneProductPHIDType.php
@@ -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}/");
+ }
+ }
+
+}
diff --git a/src/applications/phortune/phid/PhortunePurchasePHIDType.php b/src/applications/phortune/phid/PhortunePurchasePHIDType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/phid/PhortunePurchasePHIDType.php
@@ -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}/");
+ }
+ }
+
+}
diff --git a/src/applications/phortune/storage/PhortuneAccount.php b/src/applications/phortune/storage/PhortuneAccount.php
--- a/src/applications/phortune/storage/PhortuneAccount.php
+++ b/src/applications/phortune/storage/PhortuneAccount.php
@@ -81,7 +81,7 @@
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_ACNT);
+ PhortuneAccountPHIDType::TYPECONST);
}
public function getMemberPHIDs() {
diff --git a/src/applications/phortune/storage/PhortuneAccountTransaction.php b/src/applications/phortune/storage/PhortuneAccountTransaction.php
--- a/src/applications/phortune/storage/PhortuneAccountTransaction.php
+++ b/src/applications/phortune/storage/PhortuneAccountTransaction.php
@@ -10,7 +10,7 @@
}
public function getApplicationTransactionType() {
- return PhabricatorPHIDConstants::PHID_TYPE_ACNT;
+ return PhortuneAccountPHIDType::TYPECONST;
}
public function getApplicationTransactionCommentObject() {
diff --git a/src/applications/phortune/storage/PhortuneCart.php b/src/applications/phortune/storage/PhortuneCart.php
--- a/src/applications/phortune/storage/PhortuneCart.php
+++ b/src/applications/phortune/storage/PhortuneCart.php
@@ -160,7 +160,7 @@
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_CART);
+ PhortuneCartPHIDType::TYPECONST);
}
public function attachPurchases(array $purchases) {
diff --git a/src/applications/phortune/storage/PhortuneCharge.php b/src/applications/phortune/storage/PhortuneCharge.php
--- a/src/applications/phortune/storage/PhortuneCharge.php
+++ b/src/applications/phortune/storage/PhortuneCharge.php
@@ -58,7 +58,7 @@
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_CHRG);
+ PhortuneChargePHIDType::TYPECONST);
}
public function getMetadataValue($key, $default = null) {
diff --git a/src/applications/phortune/storage/PhortunePaymentMethod.php b/src/applications/phortune/storage/PhortunePaymentMethod.php
--- a/src/applications/phortune/storage/PhortunePaymentMethod.php
+++ b/src/applications/phortune/storage/PhortunePaymentMethod.php
@@ -48,7 +48,7 @@
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_PAYM);
+ PhortunePaymentMethodPHIDType::TYPECONST);
}
public function attachAccount(PhortuneAccount $account) {
diff --git a/src/applications/phortune/storage/PhortuneProduct.php b/src/applications/phortune/storage/PhortuneProduct.php
--- a/src/applications/phortune/storage/PhortuneProduct.php
+++ b/src/applications/phortune/storage/PhortuneProduct.php
@@ -37,7 +37,7 @@
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_PDCT);
+ PhortuneProductPHIDType::TYPECONST);
}
public static function initializeNewProduct() {
diff --git a/src/applications/phortune/storage/PhortunePurchase.php b/src/applications/phortune/storage/PhortunePurchase.php
--- a/src/applications/phortune/storage/PhortunePurchase.php
+++ b/src/applications/phortune/storage/PhortunePurchase.php
@@ -60,8 +60,7 @@
}
public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_PRCH);
+ return PhabricatorPHID::generateNewPHID(PhortuneChargePHIDType::TYPECONST);
}
public function attachCart(PhortuneCart $cart) {
diff --git a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
--- a/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
+++ b/src/infrastructure/edges/constants/PhabricatorEdgeConfig.php
@@ -227,9 +227,6 @@
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',
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 22, 10:26 AM (10 h, 25 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7030299
Default Alt Text
D10647.diff (16 KB)
Attached To
Mode
D10647: Modernize Phortune PHID constants
Attached
Detach File
Event Timeline
Log In to Comment