From f4fb5f0afc6a1033d1331576c005089afc0908b3 Mon Sep 17 00:00:00 2001 From: Jin Date: Mon, 24 Feb 2020 18:30:08 +0700 Subject: [PATCH] Added the Collection resource --- lib/Collection.php | 35 +++++++++++++++++++++++++++++++++++ lib/ShopifySDK.php | 3 +++ tests/CollectionTest.php | 8 ++++++++ 3 files changed, 46 insertions(+) create mode 100644 lib/Collection.php create mode 100644 tests/CollectionTest.php diff --git a/lib/Collection.php b/lib/Collection.php new file mode 100644 index 0000000..1d2c84a --- /dev/null +++ b/lib/Collection.php @@ -0,0 +1,35 @@ + Child Resources + * -------------------------------------------------------------------------- + * + * @property-read Product $Product + * + * @method Product Product(integer $id = null) + * + * @see https://shopify.dev/docs/admin-api/rest/reference/products/collection + * + */ +class Collection extends ShopifyResource +{ + /** + * @inheritDoc + */ + public $readOnly = false; + + /** + * @inheritDoc + */ + protected $resourceKey = 'collection'; + + /** + * @inheritDoc + */ + protected $childResource = array( + 'Product', + ); +} \ No newline at end of file diff --git a/lib/ShopifySDK.php b/lib/ShopifySDK.php index 7fab8c2..e6e66f5 100644 --- a/lib/ShopifySDK.php +++ b/lib/ShopifySDK.php @@ -71,6 +71,7 @@ * @property-read Blog $Blog * @property-read CarrierService $CarrierService * @property-read Collect $Collect + * @property-read Collection $Collection * @property-read Comment $Comment * @property-read Country $Country * @property-read Currency $Currency @@ -110,6 +111,7 @@ * @method Blog Blog(integer $id = null) * @method CarrierService CarrierService(integer $id = null) * @method Collect Collect(integer $id = null) + * @method Collection Collection(integer $id = null) * @method Comment Comment(integer $id = null) * @method Country Country(integer $id = null) * @method Currency Currency(integer $id = null) @@ -158,6 +160,7 @@ class ShopifySDK 'Blog', 'CarrierService', 'Collect', + 'Collection', 'Comment', 'Country', 'Currency', diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php new file mode 100644 index 0000000..2bdbd3e --- /dev/null +++ b/tests/CollectionTest.php @@ -0,0 +1,8 @@ +