- Issue created by @mxh
- 🇩🇪Germany jurgenhaas Gottmadingen
This is a challenging one. Should we probably introduce a flag in
\Drupal\eca\Plugin\DataType\DataTransferObject
to optionally turn off rekeying which should be called right before calling$list->set($index, $item);
in the action plugin? - 🇩🇪Germany mxh Offenburg
Should we probably introduce a flag in \Drupal\eca\Plugin\DataType\DataTransferObject to optionally turn off rekeying which should be called right before calling $list->set($index, $item); in the action plugin?
Either this, or initialize a DTO with a rekey option, or do both. Maybe then let the user decide whether rekey should happen, by adding a corresponding option to the "List: add item" action? There is another place where someone can add an item to a list, for example with "Token: set value" using token name
[mylist:+]
. But I think that one is probably never used by anyone. Still there may be other places where an item is being added to a list (other actions, such as merging). - 🇩🇪Germany jurgenhaas Gottmadingen
For now, I've only implemented the explicit disabling of rekeying for a DTO in the context of this action plugin. Reason being that we don't know where the DTO is being initialized, that could be almost everywhere. And using a special token syntax to disable rekeying is something that won't be used, as @mxh already stated.
- Merge request !508Issue #3521175 by mxh, jurgenhaas: Action "List: add item" ignores specified... → (Merged) created by jurgenhaas
- 🇩🇪Germany mxh Offenburg
Thanks for addressing this. Took a brief look and left one note.
- 🇩🇪Germany jurgenhaas Gottmadingen
Addressed that in another commit and commented in the MR thread.
- 🇩🇪Germany mxh Offenburg
Another suggestion, since we already check for
instanceof DTO
: We could add a helper method to the DTO "setWithoutRekey" or "setWithRekeyOption" which takes care of properly setting the rekey state back-and-forth.public function setWithRekeyOption($property_name, $value, $notify = TRUE, $disableRekey = FALSE) { $initial = $this->disableRekey; $this->disableRekey = $disableRekey; $this->set(...); $this->disableRekey = $initial; }
- 🇩🇪Germany jurgenhaas Gottmadingen
Another suggestion, since we already check for instanceof DTO: We could add a helper method to the DTO "setWithoutRekey" or "setWithRekeyOption" which takes care of properly setting the rekey state back-and-forth.
I wouldn't do that, because we're not calling
writePropertyValue
either, we're calling theset
method in the interface which may do more things than just callingwritePropertyValue
. I think what we now have should be safe. - 🇩🇪Germany mxh Offenburg
Not sure what you mean in #9 - I think calling a helper method once would be a bit more readable code rather than back-and-forth flipping of the boolean variable from the outside. Nevermind, the current state of the MR now looks also to be a working solution.
- 🇩🇪Germany mxh Offenburg
Setting to RTBC since tests are green and code looks like a working solution.
-
jurgenhaas →
committed 4834ad40 on 3.0.x
Issue #3521175 by jurgenhaas, mxh: Action "List: add item" ignores...
-
jurgenhaas →
committed 4834ad40 on 3.0.x
-
jurgenhaas →
committed 472f4eea on 2.1.x
Issue #3521175 by jurgenhaas, mxh: Action "List: add item" ignores...
-
jurgenhaas →
committed 472f4eea on 2.1.x
-
jurgenhaas →
committed a1624e95 on 2.0.x
Issue #3521175 by jurgenhaas, mxh: Action "List: add item" ignores...
-
jurgenhaas →
committed a1624e95 on 2.0.x
-
jurgenhaas →
committed b7f987d5 on 1.1.x
Issue #3521175 by jurgenhaas, mxh: Action "List: add item" ignores...
-
jurgenhaas →
committed b7f987d5 on 1.1.x
- 🇩🇪Germany jurgenhaas Gottmadingen
Merged and back ported to 2.1.x, 2.0.x, and 1.1.x
Automatically closed - issue fixed for 2 weeks with no activity.