Skip to content

Commit 2720bb2

Browse files
committed
minor #12485 Fix EvolvableLink attribute (bpolaszek)
This PR was merged into the 3.4 branch. Discussion ---------- Fix EvolvableLink attribute <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/roadmap for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `master` for features of unreleased versions). --> `Fig\Link\Link` constructor only accepts 2 parameters, `withAttribute` must be used instead of `['as' : 'style']`. (which contains a typo btw 😃 ) Commits ------- 0839ba6 Fix EvolvableLink attribute
2 parents 8ad9376 + 0839ba6 commit 2720bb2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

web_link.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,12 @@ You can also add links to the HTTP response directly from controllers and servic
166166
public function index(Request $request)
167167
{
168168
$linkProvider = $request->attributes->get('_links', new GenericLinkProvider());
169-
$request->attributes->set('_links', $linkProvider->withLink(new Link('preload', '/app.css', ['as' : 'style'])));
169+
$request->attributes->set(
170+
'_links',
171+
$linkProvider->withLink(
172+
(new Link('preload', '/app.css'))->withAttribute('as', 'style')
173+
)
174+
);
170175

171176
return $this->render('...');
172177
}

0 commit comments

Comments
 (0)