Skip to content

Commit b0b2620

Browse files
authored
Merge pull request #202 from aligent/fix/201-creation-of-dynamic-properties-deprecated-in-php8
Fix/201 creation of dynamic properties deprecated in php8
2 parents 1e71e40 + 5b67398 commit b0b2620

33 files changed

+242
-88
lines changed

RELEASE_NOTES.md

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
This release adds support for a number of new and extended BigCommerce V3 API endpoints.
2-
3-
### New Features
4-
5-
- Implement the [System Logs](https://developer.bigcommerce.com/api-reference/6908d02370409-get-system-logs)
6-
endpoint (#185)
7-
- Implement the [Pages](https://developer.bigcommerce.com/api-reference/d74089ee212a2-delete-pages) API (#184)
8-
- Implement extra Customer V3 endpoints (#181):
9-
- [Get stored instruments](https://developer.bigcommerce.com/api-reference/b735a25b3a0b8-get-stored-instruments)
10-
- [Customer Settings](https://developer.bigcommerce.com/api-reference/0c31a6d25e5ea-get-customer-settings)
11-
- [Customer Settings per Channel](https://developer.bigcommerce.com/api-reference/d5e66c45b0415-get-customer-settings-per-channel)
12-
- [Validate credentials](https://developer.bigcommerce.com/api-reference/3d731215a3dcb-validate-a-customer-credentials)
13-
- Add the ability to send and receive Images via the Product API, not just the Product Images api (#175)
14-
- Implement the [Wishlists](https://developer.bigcommerce.com/api-reference/03d6065d6f6e5-wishlist) API (#186)
15-
1+
### Fixes
162

3+
- Many deprecation notices for PHP 8.2 about creation of dynamic properties (#201)

src/BigCommerce/ResourceModels/Cart/Cart.php

+7
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,11 @@ class Cart extends ResourceModel
2222
public string $updated_time;
2323
public int $channel_id;
2424
public string $locale;
25+
public ?CartRedirectUrls $redirect_urls;
26+
27+
protected function beforeBuildObject(): void
28+
{
29+
parent::beforeBuildObject();
30+
self::buildPropertyObject('redirect_urls', CartRedirectUrls::class);
31+
}
2532
}

src/BigCommerce/ResourceModels/Cart/CartRedirectUrls.php

+1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ class CartRedirectUrls extends ResourceModel
88
{
99
public string $cart_url;
1010
public string $checkout_url;
11+
public string $embedded_checkout_url;
1112
}

src/BigCommerce/ResourceModels/Catalog/Product/Product.php

+14
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ class Product extends ResourceModel
8181
public bool $open_graph_use_image;
8282
public int $reviews_rating_sum;
8383
public int $total_sold;
84+
public int $reviews_count;
85+
public ?int $option_set_id;
86+
public ?float $calculated_price;
87+
public ?string $option_set_display;
88+
public string $product_tax_code;
89+
public int $tax_class_id;
90+
public ?float $map_price;
91+
8492
/**
8593
* @var CustomField[]|null
8694
*/
@@ -97,6 +105,11 @@ class Product extends ResourceModel
97105
*/
98106
public ?array $images;
99107

108+
/**
109+
* @var ProductVariant[]|null
110+
*/
111+
public ?array $variants;
112+
100113
public function __construct(?stdClass $optionObject = null)
101114
{
102115
if (!is_null($optionObject)) {
@@ -126,5 +139,6 @@ protected function beforeBuildObject(): void
126139
{
127140
$this->buildObjectArray('modifiers', ProductModifier::class);
128141
$this->buildObjectArray('images', ProductImage::class);
142+
$this->buildObjectArray('variants', ProductVariant::class);
129143
}
130144
}

src/BigCommerce/ResourceModels/Catalog/Product/ProductVariant.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class ProductVariant extends ResourceModel
1212
public ?int $sku_id;
1313
public ?float $price;
1414
public ?float $calculated_price;
15+
public ?float $map_price;
1516
public ?float $sale_price;
1617
public ?float $retail_price;
1718
public ?float $weight;
@@ -31,4 +32,5 @@ class ProductVariant extends ResourceModel
3132
public int $inventory_warning_level;
3233
public string $bin_picking_number;
3334
public array $option_values;
35+
public float $calculated_weight;
3436
}

src/BigCommerce/ResourceModels/Catalog/Product/ProductVideo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ProductVideo extends ResourceModel
1010

1111
public string $title;
1212
public string $description;
13-
public int $sort_oder;
13+
public int $sort_order;
1414
public string $type;
1515
public string $video_id;
1616
public int $id;

src/BigCommerce/ResourceModels/Channel/Channel.php

+1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ class Channel extends ResourceModel
4444
public bool $is_visible;
4545
public string $name;
4646
public string $status;
47+
public bool $is_enabled;
4748
}

src/BigCommerce/ResourceModels/Customer/Customer.php

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class Customer extends ResourceModel
3232
public ?array $store_credit_amounts;
3333
public ?int $origin_channel_id;
3434
public ?array $channel_ids;
35+
public ?string $registration_ip_address;
36+
public string $date_created;
37+
public string $date_modified;
3538

3639
/**
3740
* @var CustomerAddress[]

src/BigCommerce/ResourceModels/Customer/CustomerAddress.php

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ class CustomerAddress extends ResourceModel
1717
public string $phone;
1818
public string $address_type;
1919
public int $customer_id;
20+
public ?string $company;
2021
}

src/BigCommerce/ResourceModels/Order/OrderRefundItem.php

+1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ class OrderRefundItem extends ResourceModel
1616
public ?float $amount;
1717
public ?float $quantity;
1818
public ?string $reason;
19+
public ?float $requested_amount;
1920
}

src/BigCommerce/ResourceModels/Page/Page.php

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
class Page extends ResourceModel
88
{
9+
public int $id;
910
public string $name;
1011
public ?string $email;
1112
public string $meta_title;

src/BigCommerce/ResourceModels/PriceList/PriceList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ class PriceList extends ResourceModel
99
public int $id;
1010
public string $name;
1111
public string $date_created;
12-
public string $data_modified;
12+
public string $date_modified;
1313
public bool $active;
1414
}

src/BigCommerce/ResourceModels/PriceList/PriceListRecord.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ class PriceListRecord extends ResourceModel
88
{
99
public int $price_list_id;
1010
public int $variant_id;
11-
public float $price;
12-
public object $sale_price;
13-
public object $map_price;
11+
public ?float $price;
12+
public ?float $sale_price;
13+
public ?float $map_price;
1414
public float $calculated_price;
1515
public string $date_created;
1616
public string $date_modified;
1717
public string $currency;
1818
public int $product_id;
1919
public array $bulk_pricing_tiers;
20+
public ?float $retail_price;
2021
}

src/BigCommerce/ResourceModels/Redirect/Redirect.php

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class Redirect extends ResourceModel
2929
public string $from_path;
3030
public int $site_id;
3131
public RedirectTo $to;
32+
public int $id;
33+
public string $to_url;
3234

3335
public function __construct(?stdClass $optionObject = null)
3436
{

src/BigCommerce/ResourceModels/Script/Script.php

+1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ class Script extends ResourceModel
2929
public string $api_client_id;
3030
public string $consent_category;
3131
public bool $enabled;
32+
public string $name;
3233
}

src/BigCommerce/ResourceModels/Widget/Placement.php

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class Placement extends ResourceModel
1717
public int $sort_order;
1818
public string $region;
1919
public ?Widget $widget;
20+
public string $date_created;
21+
public string $date_modified;
22+
public string $uuid;
2023

2124
public function __construct(?stdClass $optionObject = null)
2225
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace BigCommerce\ApiV3\ResponseModels\Meta;
4+
5+
use BigCommerce\ApiV3\ResourceModels\ResourceModel;
6+
7+
class Links extends ResourceModel
8+
{
9+
public ?string $previous;
10+
public string $current;
11+
public ?string $next;
12+
}

src/BigCommerce/ResponseModels/Meta/Pagination.php

+8
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ class Pagination extends ResourceModel
3030
* @var int The total number of pages in the collection
3131
*/
3232
public int $total_pages;
33+
34+
public ?Links $links;
35+
36+
protected function beforeBuildObject(): void
37+
{
38+
self::buildPropertyObject('links', Links::class);
39+
parent::beforeBuildObject();
40+
}
3341
}

src/BigCommerceLegacyApi/ResourceModels/StoreInformation/StoreInformation.php

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ class StoreInformation extends ResourceModel
4242
public string $is_price_entered_with_tax;
4343
public array $active_comparison_modules;
4444
public object $features;
45+
public int $default_channel_id;
46+
public int $default_site_id;
47+
public int $store_id;
48+
public bool $plan_is_trial;
49+
public string $account_uuid;
4550

4651
public function __construct(?stdClass $optionObject = null)
4752
{

src/BigCommerceLegacyApi/ResponseModels/Order/Order.php

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class Order extends ResourceModel
5959
public string $handling_cost_ex_tax;
6060
public string $handling_cost_inc_tax;
6161
public string $ip_address;
62+
public string $ip_address_v6;
6263
public bool $is_deleted;
6364
public int $items_shipped;
6465
public int $items_total;
@@ -77,6 +78,13 @@ class Order extends ResourceModel
7778
public string $total_inc_tax;
7879
public string $wrapping_cost_ex_tax;
7980
public string $wrapping_cost_inc_tax;
81+
public string $custom_status;
82+
public string $total_tax;
83+
public ?string $credit_card_type;
84+
public ?string $external_merchant_id;
85+
public string $store_default_currency_code;
86+
public string $store_default_to_transactional_exchange_rate;
87+
8088

8189

8290
public function __construct(?stdClass $optionObject = null)

src/BigCommerceLegacyApi/ResponseModels/Order/OrderProduct.php

+9
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ class OrderProduct extends \BigCommerce\ApiV3\ResourceModels\ResourceModel
5252
public ?string $upc;
5353
public ?int $variant_id;
5454
public string $name_merchant;
55+
public int $product_id;
56+
public string $base_total;
57+
public string $total_ex_tax;
58+
public string $total_inc_tax;
59+
public string $total_tax;
60+
public string $quantity_refunded;
61+
public string $refund_amount;
62+
public string $fulfillment_source;
63+
public array $configurable_fields;
5564

5665
public function __construct(?stdClass $optionObject = null)
5766
{

tests/BigCommerce/Api/Catalog/ProductsApiTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ public function testCanGetProduct(): void
3535
$this->assertEquals('include_fields=weight%2Cwidth', $this->getLastRequest()->getUri()->getQuery());
3636
}
3737

38+
public function testCanGetProductWithoutError(): void
39+
{
40+
$this->setReturnData('catalog__products__77__get.json');
41+
$product = $this->getApi()->catalog()->product(77)->get()->getProduct();
42+
$this->assertEquals(77, $product->id);
43+
$this->assertEquals('SLCTBS', $product->sku);
44+
}
45+
3846
public function testCanGetAllPagesForProducts(): void
3947
{
4048
$this->setReturnData('catalog__products__get_all.json');

tests/BigCommerce/responses/catalog__brands__11__metafields__get_all.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"resource_type": "brand",
1010
"resource_id": 111,
1111
"id": 6,
12-
"created_at": "1973-01-20T21:34:57.903Z",
13-
"updated_at": "1990-12-30T00:29:23.515Z"
12+
"date_created": "1973-01-20T21:34:57.903Z",
13+
"date_modified": "1990-12-30T00:29:23.515Z"
1414
},
1515
{
1616
"permission_set": "read",
@@ -21,8 +21,8 @@
2121
"resource_type": "brand",
2222
"resource_id": 111,
2323
"id": 6,
24-
"created_at": "1973-01-20T21:34:57.903Z",
25-
"updated_at": "1990-12-30T00:29:23.515Z"
24+
"date_created": "1973-01-20T21:34:57.903Z",
25+
"date_modified": "1990-12-30T00:29:23.515Z"
2626
}
2727
],
2828
"meta": {

tests/BigCommerce/responses/catalog__categories__111__metafields__get_all.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"resource_type": "brand",
1010
"resource_id": 111,
1111
"id": 6,
12-
"created_at": "1973-01-20T21:34:57.903Z",
13-
"updated_at": "1990-12-30T00:29:23.515Z"
12+
"date_created": "1973-01-20T21:34:57.903Z",
13+
"date_modified": "1990-12-30T00:29:23.515Z"
1414
},
1515
{
1616
"permission_set": "read",
@@ -21,8 +21,8 @@
2121
"resource_type": "brand",
2222
"resource_id": 111,
2323
"id": 6,
24-
"created_at": "1973-01-20T21:34:57.903Z",
25-
"updated_at": "1990-12-30T00:29:23.515Z"
24+
"date_created": "1973-01-20T21:34:57.903Z",
25+
"date_modified": "1990-12-30T00:29:23.515Z"
2626
}
2727
],
2828
"meta": {

tests/BigCommerce/responses/catalog__products__174__get.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
21
2323
],
2424
"brand_id": 36,
25-
"option_set_id": {},
25+
"option_set_id": null,
2626
"option_set_display": "right",
2727
"inventory_level": 0,
2828
"inventory_warning_level": 0,

0 commit comments

Comments
 (0)