Skip to content

Commit 711dba7

Browse files
LaurentPetardNolwennP
authored andcommitted
PIM-7982: Add reference entity attribute resources
1 parent c7e964b commit 711dba7

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
### Reference entity attribute
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 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' => 'description',
16+
* 'labels' => [
17+
* 'en_US' => 'Description',
18+
* 'fr_FR' => 'Description',
19+
* ],
20+
* 'type' => 'text',
21+
* 'localizable' => true,
22+
* 'scopable' => true,
23+
* 'is_required_for_completeness' => true,
24+
* 'max_characters' => null,
25+
* 'is_textarea' => true,
26+
* 'is_rich_text_editor' => true,
27+
* 'validation_rule' => 'none',
28+
* 'validation_regexp' => null,
29+
* ]
30+
*/
31+
$referenceEntityAttribute = $client->getReferenceEntityAttributeApi()->get('brand', 'description');
32+
̀ ``
33+
34+
#### Get the list of attributes of a given reference entity
35+
36+
```php
37+
$client = new \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
38+
39+
$referenceEntityRecordsCursor = $client->getReferenceEntityAttributeApi()->all('brand');
40+
```
41+
42+
#### Upsert an attribute of a given reference entity
43+
44+
If the attribute does not exist yet, this method creates it, otherwise it updates it.
45+
46+
```php
47+
$client = new \Akeneo\PimEnterprise\ApiClient\AkeneoPimEnterpriseClientBuilder('http://akeneo.com/')->buildAuthenticatedByPassword('client_id', 'secret', 'admin', 'admin');
48+
49+
$client->getReferenceEntityAttributeApi()->upsert('brand', 'description', [
50+
'code' => 'description',
51+
'labels' => [
52+
'en_US' => 'Description'
53+
],
54+
'type' => 'text',
55+
'localizable' => true,
56+
'scopable' => true,
57+
'is_required_for_completeness' => false
58+
]);
59+
```

0 commit comments

Comments
 (0)