-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[Workflow] Add Doctrine type information for multiple state marking stores #19718
[Workflow] Add Doctrine type information for multiple state marking stores #19718
Conversation
.. tip:: | ||
|
||
You should not use the type ``simple_array`` for your marking store. | ||
Inside a multiple state marking store, places are store as keys with |
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.
Inside a multiple state marking store, places are store as keys with | |
Inside a multiple state marking stored, places are store as keys with |
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.
Not sure about this, I'm talking about the marking_store
object.
Going to try for another way to say this, like "Inside a multiple-state marking_store
" ?
Couldn't this be fixed on the code-side @lyrixx ? This sounds like a bug to me |
nope, the number of token can be superior to 1 |
And checking about with Doctrine's |
Btw, what should I do with the lint error? Remove the import completely? |
#[ORM\Column] | ||
private int $id; | ||
|
||
// Type declaration is not mandatory and |
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 like this contribution, but this comment is a bit confusing to me:
Type declaration is not mandatory ...
But in the paragraph above we're saying that we need to store this in a JSON type of column.
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.
That's true. I was trying to say that JSON is the default type inferred by Doctrine, and so one should either not declare any type, or explicitly declare Json type, but not the simple_array
. How would you phrase that in a simpler way?
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.
Maybe we could remove the comment and just use the JSON type explicitly in the example. Experienced folks can omit the type if they know that Doctrine will guess it for them.
Thanks Benjamin! |
Just experienced the behavior described inside the tip box (alongside @Spomky ):
When mapping a workflow array-marking store into Doctrine with the type
simple_array
and it contains only one key-value pair, the data stored is the value only as a string, resulting in a loss of the current place. Workflow checks then raises exception as the current place is interpreted as0
.This aims to prevent anyone else frommaking the same mistake, following advice from @nicolas-grekas