Skip to content

Commit 8d7cbf1

Browse files
authored
Merge pull request #158 from contentful/feature/php-139-document-links
Added documentation on how to link existing assets
2 parents ede8816 + 1697397 commit 8d7cbf1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@ $entry = new \Contentful\Management\Resource\Entry($contentTypeId);
233233
$entry->setField('title', 'en-US', 'My awesome blog post');
234234
$entry->setField('body', 'en-US', 'Something something...');
235235

236+
//Add existing assets
237+
$images = [
238+
new \Contentful\Core\Api\Link('Example-existing-asset-id', 'Asset'),
239+
new \Contentful\Core\Api\Link('Example-existing-asset-id-2', 'Asset'),
240+
];
241+
$entry->setField('productImages', 'en-US', $images);
242+
236243
$environmentProxy->create($entry);
237244

238245
$entry->setField('body', 'en-US', 'Updated body');

0 commit comments

Comments
 (0)