Skip to content

Commit acad99a

Browse files
committed
fix snippet line length
from #696
1 parent e32fa21 commit acad99a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

content/tutorials/guides/how-to-get-families-and-attributes.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ $client = new \GuzzleHttp\Client([
9696
Get families and attribute codes by requesting the PIM API
9797

9898
```php [activate:PHP]
99+
99100
const API_URL = '/api/rest/v1/families?search={"has_products":[{"operator":"=","value":true}]}';
100101

101102
// Make an authenticated call to the API
@@ -110,7 +111,10 @@ while (array_key_exists('next', $data['_links'])) {
110111
$response = $client->get($data['_links']['next']['href']);
111112
$data = json_decode($response->getBody()->getContents(), true);
112113
$families = array_merge($families, $data['_embedded']['items']);
113-
$attributeCodes = array_merge($attributeCodes, ...array_column($data['_embedded']['items'], 'attributes'));
114+
$attributeCodes = array_merge(
115+
$attributeCodes,
116+
...array_column($data['_embedded']['items'], 'attributes')
117+
);
114118
}
115119

116120
$attributeCodes = array_unique($attributeCodes);
@@ -136,6 +140,7 @@ This step is mandatory if you want to synchronize product variants later. If not
136140
Get family variants by requesting the PIM API for each families
137141

138142
```php [activate:PHP]
143+
139144
const MAX_ITEMS = 100;
140145
const API_URL = '/api/rest/v1/families/%s/variants?limit=' . MAX_ITEMS;
141146

@@ -159,6 +164,7 @@ saveVariants($variants);
159164
Remember your <b>attribute_code_list</b>? It’s (already) time to use it to retrieve attribute information
160165

161166
```php [activate:PHP]
167+
162168
const MAX_ITEMS = 100;
163169
const API_URL = '/api/rest/v1/attributes?search={"code":[{"operator":"IN","value":%s}]}&limit=' . MAX_ITEMS;
164170

@@ -190,4 +196,4 @@ saveAttributes($attributes);
190196
::: warning
191197
attribute_code_list may be significant, very big! If you get an <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.15" target="_blank" rel="noopener noreferrer">HTTP 414 error</a>
192198
, you probably hit these boundaries. A workaround is to split your attribute_code_list into different parts and call them independently.
193-
:::
199+
:::

0 commit comments

Comments
 (0)