-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Define simple vars on your operations #742
Conversation
loic425
commented
Aug 31, 2023
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Related tickets | |
License | MIT |
baec515
to
686b9b8
Compare
Is this PR part of bigger initiative? For example, will be vars made translatable? |
The template is responsible of the translation, there is no need to manage translations in this bundle. |
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.
Good work 👍
if (null === $resourceVars = $resource->getVars()) { | ||
return $operation; | ||
} | ||
|
||
return $operation->withVars(\array_merge($resourceVars, $operation->getVars() ?? [])); |
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.
if (null === $resourceVars = $resource->getVars()) { | |
return $operation; | |
} | |
return $operation->withVars(\array_merge($resourceVars, $operation->getVars() ?? [])); | |
return $operation->withVars( | |
\array_merge($resource->getVars() ?? [], $operation->getVars() ?? []) | |
); |
or even
if (null === $resourceVars = $resource->getVars()) { | |
return $operation; | |
} | |
return $operation->withVars(\array_merge($resourceVars, $operation->getVars() ?? [])); | |
return $operation->withVars($operation->getVars() ?? [] + $resource->getVars()); |
@@ -315,6 +317,7 @@ public function it_displays_the_metadata_for_given_resource_operation(): void | |||
routePrefix null | |||
redirectToRoute null | |||
redirectArguments null | |||
vars null |
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.
Would be great to have those vars set up in one of these tests and check if they're properly displayed
Thank you, Loïc! 🥇 |
This PR was merged into the 1.11 branch. Discussion ---------- | Q | A | --------------- | ----- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Related tickets | | License | MIT Related to #742 (comment) comment Commits ------- 9966ce5 Improve testing debug resource command
This PR was merged into the 1.11 branch. Discussion ---------- | Q | A | --------------- | ----- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Related tickets | | License | MIT Commits ------- 686b9b8 Define simple vars on your operations a38f356 Fix PHPUnit tests f27e231 Fix missing import on the documentation