From f4fb5f0afc6a1033d1331576c005089afc0908b3 Mon Sep 17 00:00:00 2001 From: Jin Date: Mon, 24 Feb 2020 18:30:08 +0700 Subject: [PATCH 1/3] 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 @@ + Date: Sat, 7 Mar 2020 10:39:23 +0600 Subject: [PATCH 2/3] [Fixes #149] Remove unnecessary line --- lib/ShopifyResource.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/ShopifyResource.php b/lib/ShopifyResource.php index 1b021d6..f9940be 100644 --- a/lib/ShopifyResource.php +++ b/lib/ShopifyResource.php @@ -599,8 +599,6 @@ public function getUrlParams($url) { public function getNextPageParams(){ $nextPageParams = []; - $nextPageLink = - parse_str($this->getUrlParams($this->getNextLink()), $nextPageParams); return $nextPageParams; } From c232b69e2aa42928f84267dca437dc9aa89eab34 Mon Sep 17 00:00:00 2001 From: Tareq Mahmood Date: Sat, 7 Mar 2020 11:06:33 +0600 Subject: [PATCH 3/3] Disable test for Collection resource --- tests/CollectionTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php index 2bdbd3e..da7ef9d 100644 --- a/tests/CollectionTest.php +++ b/tests/CollectionTest.php @@ -4,5 +4,13 @@ class CollectionTest extends TestSimpleResource { + /** + * Test get resource + * + * Post and list not available for Collection resource so testGet not possible + */ + public function testGet() + { + } } \ No newline at end of file