From fdc01456d2539961ebf39c1ed7da53a456e3bd18 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Thu, 11 Nov 2021 10:24:26 +0300 Subject: [PATCH 1/2] corrections for two namespaces --- src/Model/Entity/Store/ProductProperty.php | 61 +++++++++++++++++++ .../Entity/Store/ProductPropertyGroup.php | 37 +++++++++++ src/Model/Filter/Store/ProductProperty.php | 44 +------------ .../Filter/Store/ProductPropertyGroup.php | 20 +----- .../Store/ProductPropertiesResponse.php | 4 +- 5 files changed, 106 insertions(+), 60 deletions(-) create mode 100644 src/Model/Entity/Store/ProductProperty.php create mode 100644 src/Model/Entity/Store/ProductPropertyGroup.php diff --git a/src/Model/Entity/Store/ProductProperty.php b/src/Model/Entity/Store/ProductProperty.php new file mode 100644 index 0000000..86395b9 --- /dev/null +++ b/src/Model/Entity/Store/ProductProperty.php @@ -0,0 +1,61 @@ +") + * @JMS\SerializedName("sites") + */ + public $sites; + + /** + * @var \RetailCrm\Api\Model\Entity\Store\ProductPropertyGroup[] + * + * @JMS\Type("array") + * @JMS\SerializedName("groups") + */ + public $groups; + + /** + * @var string + * + * @JMS\Type("string") + * @JMS\SerializedName("code") + */ + public $code; + + /** + * @var string + * + * @JMS\Type("string") + * @JMS\SerializedName("name") + */ + public $name; + + /** + * @var bool + * + * @JMS\Type("bool") + * @JMS\SerializedName("isNumeric") + */ + public $isNumeric; +} diff --git a/src/Model/Entity/Store/ProductPropertyGroup.php b/src/Model/Entity/Store/ProductPropertyGroup.php new file mode 100644 index 0000000..b0f035e --- /dev/null +++ b/src/Model/Entity/Store/ProductPropertyGroup.php @@ -0,0 +1,37 @@ +") - * @JMS\SerializedName("sites") - */ - public $sites; - - /** - * @var \RetailCrm\Api\Model\Filter\Store\ProductPropertyGroup[] - * - * @JMS\Type("array") - * @JMS\SerializedName("groups") - */ - public $groups; - - /** - * @var string - * - * @JMS\Type("string") - * @JMS\SerializedName("code") - */ - public $code; - - /** - * @var string - * - * @JMS\Type("string") - * @JMS\SerializedName("name") - */ - public $name; - - /** - * @var bool - * - * @JMS\Type("bool") - * @JMS\SerializedName("isNumeric") - */ - public $isNumeric; } diff --git a/src/Model/Filter/Store/ProductPropertyGroup.php b/src/Model/Filter/Store/ProductPropertyGroup.php index f2467b1..14a025e 100644 --- a/src/Model/Filter/Store/ProductPropertyGroup.php +++ b/src/Model/Filter/Store/ProductPropertyGroup.php @@ -9,29 +9,15 @@ namespace RetailCrm\Api\Model\Filter\Store; -use RetailCrm\Api\Component\Serializer\Annotation as JMS; +use RetailCrm\Api\Model\Entity\Store\ProductPropertyGroup as Base; /** * Class ProductPropertyGroup * * @category ProductPropertyGroup * @package RetailCrm\Api\Model\Filter\Store + * @deprecated Please use RetailCrm\Api\Model\Entity\Store\ProductPropertyGroup instead. */ -class ProductPropertyGroup +class ProductPropertyGroup extends Base { - /** - * @var int - * - * @JMS\Type("int") - * @JMS\SerializedName("id") - */ - public $id; - - /** - * @var string - * - * @JMS\Type("string") - * @JMS\SerializedName("name") - */ - public $name; } diff --git a/src/Model/Response/Store/ProductPropertiesResponse.php b/src/Model/Response/Store/ProductPropertiesResponse.php index 877d264..3f2b493 100644 --- a/src/Model/Response/Store/ProductPropertiesResponse.php +++ b/src/Model/Response/Store/ProductPropertiesResponse.php @@ -21,9 +21,9 @@ use RetailCrm\Api\Model\Response\AbstractPaginatedResponse; class ProductPropertiesResponse extends AbstractPaginatedResponse { /** - * @var \RetailCrm\Api\Model\Filter\Store\ProductProperty[] + * @var \RetailCrm\Api\Model\Entity\Store\ProductProperty[] * - * @JMS\Type("array") + * @JMS\Type("array") * @JMS\SerializedName("properties") */ public $properties; From 46954b290c4a4241e3917074748a5491c2f739f7 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Thu, 11 Nov 2021 14:33:46 +0300 Subject: [PATCH 2/2] visible & variative params for product properties and filter --- src/Model/Entity/Store/ProductProperty.php | 16 ++++++++++++++++ .../Filter/Store/ProductPropertiesFilterType.php | 16 ++++++++++++++++ tests/src/ResourceGroup/StoreTest.php | 10 +++++++--- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/Model/Entity/Store/ProductProperty.php b/src/Model/Entity/Store/ProductProperty.php index 86395b9..0431913 100644 --- a/src/Model/Entity/Store/ProductProperty.php +++ b/src/Model/Entity/Store/ProductProperty.php @@ -58,4 +58,20 @@ class ProductProperty * @JMS\SerializedName("isNumeric") */ public $isNumeric; + + /** + * @var bool + * + * @JMS\Type("bool") + * @JMS\SerializedName("visible") + */ + public $visible; + + /** + * @var bool + * + * @JMS\Type("bool") + * @JMS\SerializedName("variative") + */ + public $variative; } diff --git a/src/Model/Filter/Store/ProductPropertiesFilterType.php b/src/Model/Filter/Store/ProductPropertiesFilterType.php index d313de6..8842689 100644 --- a/src/Model/Filter/Store/ProductPropertiesFilterType.php +++ b/src/Model/Filter/Store/ProductPropertiesFilterType.php @@ -35,6 +35,22 @@ class ProductPropertiesFilterType */ public $code; + /** + * @var int + * + * @Form\Type("int") + * @Form\SerializedName("visible") + */ + public $visible; + + /** + * @var int + * + * @Form\Type("int") + * @Form\SerializedName("variative") + */ + public $variative; + /** * @var string[] * diff --git a/tests/src/ResourceGroup/StoreTest.php b/tests/src/ResourceGroup/StoreTest.php index bdd1599..d5a8968 100644 --- a/tests/src/ResourceGroup/StoreTest.php +++ b/tests/src/ResourceGroup/StoreTest.php @@ -597,15 +597,19 @@ EOF; ], "code": "code", "name": "Код", - "isNumeric": false + "isNumeric": false, + "visible": true, + "variative": true } ] } EOF; - $request = new ProductPropertiesRequest(); - $request->filter = new ProductPropertiesFilterType(); + $request = new ProductPropertiesRequest(); + $request->filter = new ProductPropertiesFilterType(); $request->filter->sites = ['moysklad', 'aliexpress']; + $request->filter->visible = NumericBoolean::TRUE; + $request->filter->variative = NumericBoolean::TRUE; $mock = static::createApiMockBuilder('store/products/properties'); $mock->matchMethod(RequestMethod::GET)