Skip to content
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

Merged
merged 3 commits into from
Sep 9, 2023

Conversation

loic425
Copy link
Member

@loic425 loic425 commented Aug 31, 2023

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets
License MIT

@loic425 loic425 requested a review from a team as a code owner August 31, 2023 09:08
@diimpp
Copy link
Member

diimpp commented Sep 1, 2023

Is this PR part of bigger initiative? For example, will be vars made translatable?

@Prometee
Copy link
Contributor

Prometee commented Sep 1, 2023

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.

Copy link
Member

@oallain oallain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work 👍

@Zales0123 Zales0123 added the Feature New feature proposals. label Sep 9, 2023
Comment on lines +59 to +63
if (null === $resourceVars = $resource->getVars()) {
return $operation;
}

return $operation->withVars(\array_merge($resourceVars, $operation->getVars() ?? []));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Suggested change
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
Copy link
Member

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

@Zales0123 Zales0123 merged commit d5bced3 into Sylius:1.11 Sep 9, 2023
44 checks passed
@Zales0123
Copy link
Member

Thank you, Loïc! 🥇

@loic425 loic425 deleted the feature/operation-vars branch September 10, 2023 06:05
Zales0123 added a commit that referenced this pull request Sep 11, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants