Skip to content

Update stream-everything.md #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sfcasts/turbo/stream-everything.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ In `symfony/ux-turbo` 2.1 and higher, this code has changed:

```php
if (TurboBundle::STREAM_FORMAT === $request->getPreferredFormat()) {
$request->setFormat(TurboBundle::STREAM_FORMAT);
$request->setRequestFormat(TurboBundle::STREAM_FORMAT);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I'm not sure about this change. I suppose the example was taken from the official docs: https://symfony.com/bundles/ux-turbo/current/index.html#forms - there we have $request->setFormat(TurboBundle::STREAM_FORMAT);. If it does not work - then it should be fixed upstream in the Symfony docs as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not working, there are several issues about it on symfony github, as well as pull requests.

symfony/ux#297

/**
 * Associates a format with mime types.
 * /
public function setFormat(?string $format, $mimeTypes)

/**
 * Sets the request format.
*/
public function setRequestFormat(?string $format)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I see it, you're right! And it seems it was already fixed upstream in the docs I referenced above 👍


return $this->render('product/reviews.stream.html.twig', [
'product' => $product,
Expand Down