diff --git a/web_link.rst b/web_link.rst index fd13492add5..b50316d79e8 100644 --- a/web_link.rst +++ b/web_link.rst @@ -166,7 +166,12 @@ You can also add links to the HTTP response directly from controllers and servic public function index(Request $request) { $linkProvider = $request->attributes->get('_links', new GenericLinkProvider()); - $request->attributes->set('_links', $linkProvider->withLink(new Link('preload', '/app.css', ['as' : 'style']))); + $request->attributes->set( + '_links', + $linkProvider->withLink( + (new Link('preload', '/app.css'))->withAttribute('as', 'style') + ) + ); return $this->render('...'); }