-
-
Notifications
You must be signed in to change notification settings - Fork 353
[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
Conversation
src/Turbo/doc/index.rst
Outdated
**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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When did this change ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) ?
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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" ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 :).
Thank you @seb-jean. |
Fixed documentation regarding blocks when using broadcast. Blocks are not required.