From ed76795493ec5787ecd8368cbd2da1b4beeb0bf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Galin=CC=81ski?= Date: Fri, 21 Jul 2023 08:55:18 +0200 Subject: [PATCH 1/2] Add support for getting Table select options attribute --- src/Api/AttributeApi.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Api/AttributeApi.php b/src/Api/AttributeApi.php index 7ce663e2..0be0cd70 100644 --- a/src/Api/AttributeApi.php +++ b/src/Api/AttributeApi.php @@ -39,6 +39,20 @@ public function get(string $code): array return $this->resourceClient->getResource(static::ATTRIBUTE_URI, [$code]); } + /** + * Get attribute with table select options. + * This method is not part of the official API. + * It is used to get the table select options of an attribute. + * + * @param string $code + * + * @return array + */ + public function getWithTableSelectOptions(string $code): array + { + return $this->resourceClient->getResource(static::ATTRIBUTE_URI, [$code], ['with_table_select_options' => true]); + } + /** * {@inheritdoc} */ From 67c1ddec96a5c5d46fdeba55b7d589ae86096420 Mon Sep 17 00:00:00 2001 From: Kuba-Galinski Date: Fri, 21 Jul 2023 10:43:20 +0200 Subject: [PATCH 2/2] Add query parameters to get method in AttribiteApi Class what will allow to use i.e. with_table_select_option parameter for specify attribute --- src/Api/AttributeApi.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Api/AttributeApi.php b/src/Api/AttributeApi.php index 0be0cd70..c531598e 100644 --- a/src/Api/AttributeApi.php +++ b/src/Api/AttributeApi.php @@ -34,23 +34,9 @@ public function __construct( /** * {@inheritdoc} */ - public function get(string $code): array + public function get(string $code, array $queryParameters = []): array { - return $this->resourceClient->getResource(static::ATTRIBUTE_URI, [$code]); - } - - /** - * Get attribute with table select options. - * This method is not part of the official API. - * It is used to get the table select options of an attribute. - * - * @param string $code - * - * @return array - */ - public function getWithTableSelectOptions(string $code): array - { - return $this->resourceClient->getResource(static::ATTRIBUTE_URI, [$code], ['with_table_select_options' => true]); + return $this->resourceClient->getResource(static::ATTRIBUTE_URI, [$code], $queryParameters); } /**