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

[API]Unify change quantity endpoint with other orders endpoints #12530

Merged
merged 2 commits into from
Apr 15, 2021

Conversation

arti0090
Copy link
Contributor

@arti0090 arti0090 commented Apr 14, 2021

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
License MIT

@arti0090 arti0090 requested a review from a team as a code owner April 14, 2021 07:00
@probot-autolabeler probot-autolabeler bot added API APIs related issues and PRs. Maintenance CI configurations, READMEs, releases, etc. labels Apr 14, 2021
@arti0090
Copy link
Contributor Author

Zrzut ekranu 2021-04-14 o 08 52 33

{
public function transform($object, string $to, array $context = [])
{
$object->setOrderItemId($this->getOrderItemIdFromUri($context['request_uri']));
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if you can get some more information from context to choose this id in a better way instead of getting the last part of IRI. The current solution works for the implemented endpoint, but is not a generic one, what could be problematic in future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunatelly there are 3 places where there is ID 1st one was this, 2nd was full request ( with hostname) and 3rd place were orderItemId's that were in order ( but this is not something we could use) hence I choose this one

src/Sylius/Behat/Context/Api/Shop/CartContext.php Outdated Show resolved Hide resolved
Comment on lines 11 to 13
public function transform($object, string $to, array $context = [])
{
$explodedUri = explode('/', $context['request_uri']);
Copy link
Member

Choose a reason for hiding this comment

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

Can we fetch from the context that this is really our endpoint with orderItemId at the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This Transformer is longer exist :D thanks to your comment I changed it to subresource one and it works fine


public function setSubresourceId(?string $subresourceId): void
{
$this->orderItemId= $subresourceId;
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
$this->orderItemId= $subresourceId;
$this->orderItemId = $subresourceId;

@GSadee GSadee merged commit 9bf89bb into Sylius:master Apr 15, 2021
@GSadee
Copy link
Member

GSadee commented Apr 15, 2021

Thank you, @arti0090! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API APIs related issues and PRs. Maintenance CI configurations, READMEs, releases, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants