Skip to content

[Turbo] Minor documentation syntax fixes #2692

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 14, 2025
Merged

Conversation

seb-jean
Copy link
Contributor

Q A
Bug fix? no
New feature? no
Docs? yes
Issues Fix #...
License MIT

Fixed documentation regarding blocks when using broadcast. Blocks are not required.

@carsonbot carsonbot added Turbo Status: Needs Review Needs to be reviewed labels Apr 11, 2025
Comment on lines 842 to 841
**must** contain at least 3 blocks: ``create``, ``update`` and
``remove`` (they can be empty, but they must exist).
``templates/broadcast/{ClassName}.stream.html.twig``. This template can contain 3 blocks: ``create`` block for entity creation. ``update`` block for entity update. ``remove`` block for entity deletion.
Copy link
Member

Choose a reason for hiding this comment

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

When did this change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know when it changed but I only tested with the create block in my template and I didn't encounter any errors.

Copy link
Member

Choose a reason for hiding this comment

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

Even during an update and a remove broadcast (just to be sure) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly, it also works for update and remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And of course, they are mandatory when creating, deleting or updating, otherwise an error is returned.

Copy link
Member

Choose a reason for hiding this comment

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

Wait so they "can" or they "must" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

create block must be present if it's a creation.
update block must be present if it's an update.
remove block must be present if it's a deletion.

For example, for my Book entity, I need to render a template on creation and update. I should have the following code:

{# templates/broadcast/Book.stream.html.twig #}
{% block create %}
  [...]
{% endblock %}

{% block update %}
  [...]
{% endblock %}

The remove block isn't present, and it works.

With the current documentation, the developer will think it's necessary to do this:

{# templates/broadcast/Book.stream.html.twig #}
{% block create %}
  [...]
{% endblock %}

{% block update %}
  [...]
{% endblock %}

{% block remove %}
{% endblock %}

With an empty remove block, but this isn't necessary.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure i agree with this way of presenting thing. Their entity can be deleted or updated. If this happens and they did not put these blocks here, their app will crash.

I'd say we need either a way to explain it very clearly, or let's keep the current formulation.

WDYT ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah ok, let's keep the current formulation then :).

@smnandre smnandre added the docs Improvements or additions to documentation label Apr 11, 2025
@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Apr 14, 2025
@Kocal Kocal changed the title [Turbo] Documentation for broadcast [Turbo] Minor documentation syntax fixes Apr 14, 2025
@Kocal
Copy link
Member

Kocal commented Apr 14, 2025

Thank you @seb-jean.

@Kocal Kocal merged commit 9535e0f into symfony:2.x Apr 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation Status: Reviewed Has been reviewed by a maintainer Turbo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants