Skip to content

Commit 632b133

Browse files
authored
Merge pull request #145 from ndhan93/master
Added the Collection resource
2 parents a754499 + f4fb5f0 commit 632b133

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

lib/Collection.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
namespace PHPShopify;
4+
5+
/**
6+
* --------------------------------------------------------------------------
7+
* Collection -> Child Resources
8+
* --------------------------------------------------------------------------
9+
*
10+
* @property-read Product $Product
11+
*
12+
* @method Product Product(integer $id = null)
13+
*
14+
* @see https://shopify.dev/docs/admin-api/rest/reference/products/collection
15+
*
16+
*/
17+
class Collection extends ShopifyResource
18+
{
19+
/**
20+
* @inheritDoc
21+
*/
22+
public $readOnly = false;
23+
24+
/**
25+
* @inheritDoc
26+
*/
27+
protected $resourceKey = 'collection';
28+
29+
/**
30+
* @inheritDoc
31+
*/
32+
protected $childResource = array(
33+
'Product',
34+
);
35+
}

lib/ShopifySDK.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
* @property-read Blog $Blog
7272
* @property-read CarrierService $CarrierService
7373
* @property-read Collect $Collect
74+
* @property-read Collection $Collection
7475
* @property-read Comment $Comment
7576
* @property-read Country $Country
7677
* @property-read Currency $Currency
@@ -110,6 +111,7 @@
110111
* @method Blog Blog(integer $id = null)
111112
* @method CarrierService CarrierService(integer $id = null)
112113
* @method Collect Collect(integer $id = null)
114+
* @method Collection Collection(integer $id = null)
113115
* @method Comment Comment(integer $id = null)
114116
* @method Country Country(integer $id = null)
115117
* @method Currency Currency(integer $id = null)
@@ -158,6 +160,7 @@ class ShopifySDK
158160
'Blog',
159161
'CarrierService',
160162
'Collect',
163+
'Collection',
161164
'Comment',
162165
'Country',
163166
'Currency',

tests/CollectionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace PHPShopify;
4+
5+
class CollectionTest extends TestSimpleResource
6+
{
7+
8+
}

0 commit comments

Comments
 (0)