Skip to content

Commit 151f304

Browse files
LaurentPetardNolwennP
authored andcommitted
PIM-7984: Add reference entity attribute option resources
1 parent 5cafaae commit 151f304

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
### Reference entity attribute option
2+
3+
::: warning
4+
This resource is only available in the [Entreprise Edition](https://www.akeneo.com/enterprise-edition/).
5+
:::
6+
7+
#### Get an attribute option for a given attribute of a given reference entity
8+
9+
```php
10+
$client = new \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
11+
12+
/*
13+
* Returns an array like this:
14+
* [
15+
* 'code' => 'red',
16+
* 'labels' => [
17+
* 'en_US' => 'Red',
18+
* 'fr_FR' => 'Rouge',
19+
* ]
20+
* ]
21+
*/
22+
$referenceEntityAttributeOption = $client->getReferenceEntityAttributeOptionApi()->get('designer', 'favorite_color', 'red');
23+
```
24+
25+
#### Get the list of attribute options of a given attribute for a given reference entity
26+
27+
```php
28+
$client = new \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
29+
30+
$referenceEntityAttributeOptions = $client->getReferenceEntityAttributeOptionApi()->all('designer', 'favorite_color');
31+
```
32+
33+
#### Upsert an attribute option for a given attribute of a given reference entity
34+
35+
If the attribute option does not exist yet, this method creates it, otherwise it updates it.
36+
37+
```php
38+
$client = new \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
39+
40+
$client->getReferenceEntityAttributeOptionApi()->upsert('designer', 'favorite_color', 'blue', [
41+
'code' => 'blue',
42+
'labels' => [
43+
'en_US' => 'Blue',
44+
'fr_FR' => 'Bleu',
45+
]
46+
]);
47+
```

0 commit comments

Comments
 (0)