-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[Workflow] Add a line about the attribute type when persisted. #9156
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
@lyrixx could you please review this proposal? Thanks! |
With a multiple marking store, it's indeed true.
|
@lyrixx In fact, I've noticed this "approach" after trying to persist the attribute, I can understand that it seems strange to do it. I've don't see that it overload the getting started block ... Maybe we can rewrite the default name using |
About the issue:
And juste to make thing really clear, the MarkingStore is not coupled to a Workflow / StateMachine. |
Sadly this pull request has stalled. Should we reword it, create a different one or close it as "won't merge"? Thanks! |
This need to be reworded I think ;) |
Yes, I need to have time to work on the reword, I'm gonna take some time this weekend in order to work on this PR. |
Friendly ping to not forget about this. Thanks! |
@javiereguiluz Yes, need to take time this week to finish this PR. |
Fix on the storage format (probably need to be reworded).
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.
Looks good to me! Thanks for clarifying this.
workflow/usage.rst
Outdated
If a ``multiple_state`` is used, the persisted state type should be an ``array``, | ||
using Doctrine, you can use ``json`` or ``json_array``. | ||
|
||
If a ``single_state`` is used, the persisted state type could be a string |
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.
Or it could be also an integer, but you need to implement a MarkingStoreInterface to convert from string to int the place.
I see more often values of a $status property of object stored as int in the database, not string
Explaining it here could be very usefull to inform that we can do it easily IMO :)
cc @Guikingone
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.
Thanks for the feedback, I've added new lines about this case, can you review it and tell me if it's adapted? 🤔
Thanks 😊
An improvement has been made in order to explain the usage of an int via MarkingStoreInterface
Should we close this pull request without merging it? First, the mentioned |
maybe wait symfony/symfony#29146 to be merged? and after document all cases? but i really think a documentation (with example) is a must have for this part having a use case could be a nice one :) |
No It should not be closed. This PR is good 👍 Let's merge it (except for json_array) |
We could remove the |
workflow/usage.rst
Outdated
If a ``multiple_state`` is used, the persisted state type should be an ``array``, | ||
using Doctrine, you can use ``json`` or ``json_array``. | ||
|
||
If a ``single_state`` is used, the persisted state type could be a string, |
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.
"could be a string" or "should be a string" ... we say "should be an array" in the previous paragraph.
be aware that you need to implement :class:`Symfony\\Component\\Workflow\\MarkingStore\\MarkingStoreInterface` | ||
in order to transform the int back to something understandable by Workflow. | ||
|
||
If something else is used, you're in charge of choosing the best storage format. |
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.
Does the previous tip related to MarkingStoreInterface apply in this case too? If yes, we must merge these two phrases.
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.
@javiereguiluz yes it's apply to. So it should be merged
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.
@Guikingone could you merge theses phrase? Thanks.
After that, IMHO, we will be OK to merge it
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.
Improved, to be checked 🙂
workflow/usage.rst
Outdated
|
||
.. note:: | ||
|
||
If a ``multiple_state`` is used, the persisted state type should be an ``array``, |
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.
This prhase needs some reword. It reads as "should be an array using Doctrine". Do you mean, a "PHP array" in the entity property and a "json" type in the @Column
mapping?
workflow/usage.rst
Outdated
class BlogPost | ||
{ | ||
// This property is used by the marking store | ||
// This property is used by the marking store, by default, Symfony "mark" this attribute as an array. |
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 understand what this means --> "Symfony mark this attribute as an array" Is this something that can only be understood if you use the Workflow component (which I don't) ... or is it supposed to be understood by all readers? Thanks!
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.
May be this is better:
By default symfony set the marking as an array.
as or with, I don't know
@Guikingone please, rebase this to 3.4 so we can merge it. Thank you. |
55b36e1
to
d1c0dd0
Compare
Hi 👋 Can you please check one last time this PR before the final rebase, this way, we can close it, thanks :) |
@Guikingone there are some changes/new feature arround this storage part of the workflow |
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.
Thanks for your PR. I added few comments.
be aware that you need to implement :class:`Symfony\\Component\\Workflow\\MarkingStore\\MarkingStoreInterface` | ||
in order to transform the int back to something understandable by Workflow. | ||
|
||
If something else is used, you're in charge of choosing the best storage format. |
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.
@javiereguiluz yes it's apply to. So it should be merged
Co-Authored-By: Mathieu Santostefano <[email protected]>
.. tip:: | ||
|
||
The ``type`` (default value ``single_state``) and ``arguments`` (default value ``marking``) |
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.
@Guikingone For 4.3+ this need to be removed no?
As single/multiple state are deprecated/removed in favor of method
This PR must be rewrite for method marking store IMO
By default, the attribute must be an array in order to allow PropertyAccess to update the state and content of this last one, if we need to persist it via Doctrine, the mapping must define an array.