-
Notifications
You must be signed in to change notification settings - Fork 283
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
Allow multiple dispatch, fire, notify and send statements #623
Allow multiple dispatch, fire, notify and send statements #623
Conversation
This requires quite some regex voodoo to get it working. It's almost working but there seems to be something somewhere that causes duplication, for example when you run |
I can take a stab if you want to leave it for the weekend. |
I'll continue tomorrow on it but feel free to poke around, probably something obvious that causes the array items to get duplicated 😅 |
Cool. You on Twitter? I'll give you a shout out. |
I think parsing out the However, thinking about it more, these statements may not be sequential. And moving them into a single array, may not generate the code the user intended. For example: validate: title, content
save: ticket
send: ReviewNotification to:ticket.reviewer with:ticket
dispatch: SyncMedia with:ticket
send: TicketOpened to:ticket.author with:ticket As such, I think simply finding these indented properties and giving them a numerical suffix is the way to go. Then update the lexer to handle numbered properties when creating the statement. If so, you could likely revert #619. |
@jasonmccreary updated the OP with the (I think) final changes |
I foresee a lot of bugs, but here we go... |
This new approach preprocesses the YAML content and transforms duplicate keys into keys that are suffixed with their line number to avoid key collisions. This also reverts #619.
Input
https://github.com/laravel-shift/blueprint/pull/623/files#diff-a4f4e06b3fdb4a8424880f544fca3c75a0ecf2ebb5158feba4963f7066e2d265
Output
https://github.com/laravel-shift/blueprint/pull/623/files#diff-72d9e08bf23239b5487ea8767fe78e8f3e9be1b14e5bd64e1ae2c4848da167f1