Skip to content

Commit

Permalink
Use standard table name
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Feb 13, 2018
1 parent 2bd287a commit 5ab1a40
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 6 deletions.
13 changes: 13 additions & 0 deletions legacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
Name: silvershop-discounts-legacy
---
# Mapping rules to map old model-classes to new ones.
SilverStripe\ORM\DatabaseAdmin:
classname_value_remapping:
Discount: SilverShop\Discounts\Model\Discount
GiftVoucherOrderItem: SilverShop\Discounts\Model\GiftVoucherOrderItem
OrderDiscountModifier: SilverShop\Discounts\Model\Modifiers\OrderDiscountModifier
OrderCoupon: SilverShop\Discounts\Model\OrderCoupon
OrderDiscount: SilverShop\Discounts\Model\OrderDiscount
PartialUseDiscount: SilverShop\Discounts\Model\PartialUseDiscount
SpecificPrice: SilverShop\Discounts\Model\SpecificPrice
2 changes: 1 addition & 1 deletion src/Model/Discount.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Discount extends DataObject

private static $default_sort = "EndDate DESC, StartDate DESC";

private static $table_name = 'Discount';
private static $table_name = 'SilverShop_Discount';

protected $message;

Expand Down
2 changes: 1 addition & 1 deletion src/Model/GiftVoucherOrderItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class GiftVoucherOrderItem extends OrderItem
"UnitPrice"
];

private static $table_name = 'GiftVoucherOrderItem';
private static $table_name = 'SilverShop_GiftVoucherOrderItem';

/**
* Don't get unit price from product
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Modifiers/OrderDiscountModifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class OrderDiscountModifier extends OrderModifier

private static $plural_name = "Discounts";

private static $table_name = 'OrderDiscountModifier';
private static $table_name = 'SilverShop_OrderDiscountModifier';

public function value($incoming)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Model/OrderCoupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class OrderCoupon extends Discount

private static $generated_code_length = 10;

private static $table_name = OrderCoupon::class;
private static $table_name = 'SilverShop_OrderCoupon';

public static function get_by_code($code)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Model/OrderDiscount.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
*/
class OrderDiscount extends Discount
{

private static $table_name = 'SilverShop_OrderDiscount';
}
2 changes: 1 addition & 1 deletion src/Model/PartialUseDiscount.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PartialUseDiscount extends Discount

private static $plural_name = "Partial Use Discounts";

private static $table_name = 'PartialUseDiscount';
private static $table_name = 'SilverShop_PartialUseDiscount';

public function getCMSFields($params = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Model/SpecificPrice.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SpecificPrice extends DataObject

private static $default_sort = "\"Price\" ASC";

private static $table_name = 'SpecificPrice';
private static $table_name = 'SilverShop_SpecificPrice';

public static function filter(DataList $list, $member = null)
{
Expand Down

0 comments on commit 5ab1a40

Please sign in to comment.