Contentful logo

Contentful Community

How to link asset to an entry and publish

Hello folks!

I’m able to upload an image, process asynchronously and publish the asset. I’m also able to create and publish a typical Entry.

I have a field that is optional, and takes an image file. How can I link the newly uploaded asset ID, to the old Entry? I believe the step missing involves the creation of a Link, before the fields can be set. Is this correct?

Thanks!

$addressEntry->asLink()

was the answer!