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

Merge API Platform 3 to 2.0 branch #16847

Merged
merged 752 commits into from
Sep 4, 2024
Merged

Merge API Platform 3 to 2.0 branch #16847

merged 752 commits into from
Sep 4, 2024

Conversation

GSadee
Copy link
Member

@GSadee GSadee commented Sep 4, 2024

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

As the upgrade of our API to API Platform 3 is almost completed, it is high time to merge these changes to branch 2.0 and finish the work there.

Rafikooo and others added 30 commits August 2, 2024 14:02
…fikooo)

This PR was merged into the api-platform-3 branch.

Discussion
----------

| Q               | A
|-----------------|-----
| Branch?         | api-platform-3 <!-- see the comment below -->
| Bug fix?        | no
| New feature?    | yes
| BC breaks?      | no
| Deprecations?   | no <!-- don't forget to update the UPGRADE-*.md file -->
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
 - Features, removing deprecations and BC breaks must be submitted against the 2.0 branch
 - Make sure that the correct base branch is set

 To be sure you are not breaking any Backward Compatibilities, check the documentation:
 https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


Commits
-------
  [Unit] Update Channels tests to include embedded shop billing data
  [Unit] Improve channel fixtures with more descriptive data
  [Unit] Remove obsolete shop billing data response files
  [Unit] Update channel tests responses to include shop billing data
  [API] Remove obsolete serialization groups from Channel resource
  [API] Update serialization groups of ShopBillingData resource
  [API] Configure ShopBillingData field as embedded Channel's resource
  [Behat] Update ManagingChannelsBillingDataContext class
  [Unit] ChannelsTest code refactor
  [Unit] Add requestPost util function and other related code
  [Unit] Use requestPost util method in ChannelsTest
  [Unit] Enable deleting the only channel test
| Q               | A
|-----------------|-----
| Branch?         | api-platform-3
| Bug fix?        | no
| New feature?    | somewhat
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | -
| License         | MIT
| Q               | A
|-----------------|-----
| Branch?         | api-platform-3
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | n/a
| License         | MIT
| Q               | A
|-----------------|-----
| Branch?         | api-platform-3 <!-- see the comment below -->
| Bug fix?        | no
| New feature?    | yes
| BC breaks?      | no
| Deprecations? | no <!-- don't forget to update the UPGRADE-*.md file
-->
| License         | MIT
* 2.0: (64 commits)
  [Admin] Rename parameter
  [Admin] Change command handlers and console command ids to dotted notation
  [Core] Change command handlers and console command ids to dotted notation
  [Core] Use new services
  [Core] Rename Message to Command
  [Admin] Rename Message to Command
  [Promotion] Remove deprecated commands
  [Ui] Remove deprecated commands
  [User] Remove deprecated commands
  [Admin] Configure and use anonymous view in store component
  [Admin] Add missing order notes information
  [Behat] Use test attribute to retrieve order notes
  [Admin] Render pagination and enabled filter test attributes
  [Behat] Enable scenarios and improve implementation for filtered pages redirections
  [Admin] Render view in store button in the variant edit page
  [CS][DX] Refactor
  [Behat] Improve view product in store action
  [Behat] Enable viewing product in store from variant edit page scenarios
  [Behat] Enable deleting multiple product variants scenario
  [Behat] Enable remaining managing users scenario
  ...
GSadee and others added 18 commits September 3, 2024 07:40
* 2.0:
  [CS][DX] Refactor
  [CS][DX] Refactor
  [CS][DX] Refactor
  [CI] Update Sylius branches in refactor workflow
  [Behat] Switch another random JS failed scenarios to Chromedriver
  [Behat] Switch another random JS failed scenarios to Chromedriver
  [Behat] Switch random JS failed scenarios to Chromedriver
  [CS][DX] Refactor
| Q               | A
|-----------------|-----
| Branch?         | api-platform-3
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations? | no<!-- don't forget to update the UPGRADE-*.md file
-->
| Related tickets | 
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->
| Q               | A
|-----------------|-----
| Branch?         | api-platform-3
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations? | no<!-- don't forget to update the UPGRADE-*.md file
-->
| Related tickets | 
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->
| Q               | A
|-----------------|-----
| Branch?         | api-platform-3
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations? | no<!-- don't forget to update the UPGRADE-*.md file
-->
| Related tickets | 
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->
| Q               | A
|-----------------|-----
| Branch?         | api-platform-3
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations? | no<!-- don't forget to update the UPGRADE-*.md file
-->
| Related tickets | 
| License         | MIT

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->
* 2.0:
  Fix data grid sorting when there are no defaults
  [Admin][CatalogPromotion] Fix icon for show variants link
@GSadee GSadee requested review from a team as code owners September 4, 2024 09:06
@probot-autolabeler probot-autolabeler bot added the Maintenance CI configurations, READMEs, releases, etc. label Sep 4, 2024
Copy link

github-actions bot commented Sep 4, 2024

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

@mpysiak mpysiak merged commit d366932 into 2.0 Sep 4, 2024
54 checks passed
@GSadee GSadee deleted the api-platform-3 branch September 4, 2024 10:14
Copy link
Member

@diimpp diimpp left a comment

Choose a reason for hiding this comment

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

I'm afraid GH will loose my comments, if I will do it over several days, so here is first batch.

image

Scenario: Filtering tax categories by name
When I search by "Food" name
When I search by "ood" name
Copy link
Member

Choose a reason for hiding this comment

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

---         When I search by "ood" name
+++         When I search by "Food" name

If Food is not a desired search string, then some other human readable word should be used.

- `Sylius\Bundle\ApiBundle\DataPersister\*DataPersister` => `Sylius\Bundle\ApiBundle\StateProcessor\*Processor`
- `Sylius\Bundle\ApiBundle\DataProvider\*DataProvider` => `Sylius\Bundle\ApiBundle\StateProvider\*Provider`

* API Platform has also dropped `DataTransformers` in favor of which `some of them` have been refactored into `SerializerContextBuilders` as follows:
Copy link
Member

@diimpp diimpp Sep 4, 2024

Choose a reason for hiding this comment

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

Bold or italic would suit better than code for text accent.

--- * API Platform has also dropped `DataTransformers` in favor of which `some of them` have been refactored into `SerializerContextBuilders` as follows:
+++ * API Platform has also dropped `DataTransformers` in favor of which **some of them** have been refactored into `SerializerContextBuilders` as follows:

Comment on lines +58 to +61
+ protected ?string $channelCode,
+ protected ?string $localeCode,
+ protected ?string $email = null,
+ protected ?string $message = null,
Copy link
Member

Choose a reason for hiding this comment

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

While it's a correct sorting order from CS point of view, that's strange from business point of view.

* The constructor of `Sylius\Bundle\ApiBundle\Command\Account\RequestShopUserVerification` has been created:
```php
public function __construct(
+ protected string|int|null $shopUserId,
Copy link
Member

Choose a reason for hiding this comment

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

$shopUserId typehint should be identical between ChangeShopUserPassword and RequestShopUserVerification (Other commands?)

Currently it's

    +   protected mixed $shopUserId,
    +   protected string|int|null $shopUserId,


## Decision Drivers

* Moving from DataProviders to StateProviders
Copy link
Member

Choose a reason for hiding this comment

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

Since previous parts of document highlight these words as code, then this probably should as well.

--- * Moving from DataProviders to StateProviders
+++ * Moving from `DataProviders` to `StateProviders`


## Decision Outcome

Chosen option: `Separate StateProviders by sections and resources`,
Copy link
Member

@diimpp diimpp Sep 4, 2024

Choose a reason for hiding this comment

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

I've browsed other ADRs and there is no clear syntax to highlight chosen option, but bold, italic or underline should be better choice.

Chosen option: Separate StateProviders by sections and resources,
Chosen option: Separate StateProviders by sections and resources
Chosen option: Separate StateProviders by sections and resources
Chosen option: Separate StateProviders by sections and resources
Chosen option: Separate StateProviders by sections and resources
Chosen option: Separate StateProviders by sections and resources

Doctrine/ORM/QueryExtension/
/Admin
/Product
ExampleExtension.php
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 cool to show extension types over here, like

ItemExtension.php
CollectionExtension.php


## Decision Drivers

* Migrate from DataPersisters to StateProcessors
Copy link
Member

Choose a reason for hiding this comment

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

--- * Migrate from DataPersisters to StateProcessors
+++ * Migrate from `DataPersisters` to `StateProcessors`


## Decision Outcome

Chosen option: Separate StateProcessors by sections, resources, and operations,
Copy link
Member

@diimpp diimpp Sep 4, 2024

Choose a reason for hiding this comment

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

Chosen option needs to be highlighted as in two previous ADRs.

Following existing scheme,

--- Chosen option: Separate StateProcessors by sections, resources, and operations,
+++ Chosen option: `Separate StateProcessors by sections, resources, and operations`,

Suggested change,

--- Chosen option: Separate StateProcessors by sections, resources, and operations,
+++ Chosen option: **<ins>Separate StateProcessors by sections, resources, and operations</ins>**,

orderTokenValue: $tokenValue,
shipmentId: $shipmentId,
shippingMethodCode: $shippingMethodCode,
);
Copy link
Member

Choose a reason for hiding this comment

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

Spacing issue

---   );
+++       );

$this->addItemToCart($productVariantCode, $quantity, $tokenValue);
$cart = $this->updateCartWithAddressAndCouponCode($tokenValue, $email, $couponCode);
$this->dispatchShippingMethodChooseCommand(
$tokenValue,
'UPS',
(string) $cart->getShipments()->first()->getId(),
$cart->getShipments()->first()->getId(),
Copy link
Member

Choose a reason for hiding this comment

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

Similar to getLastPayment, you should use last available shipment, so

---             $cart->getShipments()->first()->getId(),
+++             $cart->getShipments()->last()->getId(),

@@ -60,12 +60,12 @@ protected function fulfillOrder(
$this->dispatchShippingMethodChooseCommand(
$tokenValue,
'UPS',
(string) $cart->getShipments()->first()->getId(),
$cart->getShipments()->first()->getId(),
Copy link
Member

Choose a reason for hiding this comment

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

---            $cart->getShipments()->first()->getId(),
+++            $cart->getShipments()->last()->getId(),


/** @var ProductImageInterface $productImage */
$productImage = $fixtures['product_mug_thumbnail'];
/** @var ProductInterface $product */
Copy link
Member

Choose a reason for hiding this comment

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

Outside of scope of current PR, but we should add return type to ProductImage/TaxonImage instead.

'shop/product_attribute/get_product_attribute_value',
Response::HTTP_OK,
);
$this->requestGet('/api/v2/shop/product-attribute-values/' . $attributeValue->getId());
Copy link
Member

Choose a reason for hiding this comment

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

A matter of taste, but would be cool to use same syntax over all tests.

---         $this->requestGet('/api/v2/shop/product-attribute-values/' . $attributeValue->getId());
+++         $this->requestGet(sprintf('/api/v2/shop/product-attribute-values/%s', $attributeValue->getId()));

$order = $this->placeOrder('token', 'guest@doe.com');

$this->requestGet(
uri: sprintf('/api/v2/shop/orders/token/payments/%s/configuration', $order->getPayments()->first()->getId()),
Copy link
Member

Choose a reason for hiding this comment

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

---             uri: sprintf('/api/v2/shop/account/orders/token/payments/%s', $order->getPayments()->first()->getId()),
+++             uri: sprintf('/api/v2/shop/account/orders/token/payments/%s', $order->getLastPayment()->getId()),

$order = $this->placeOrder('token', 'guest@doe.com');

$this->requestGet(
uri: sprintf('/api/v2/shop/orders/token/payments/%s/configuration', $order->getPayments()->first()->getId()),
Copy link
Member

Choose a reason for hiding this comment

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

---             uri: sprintf('/api/v2/shop/account/orders/token/payments/%s', $order->getPayments()->first()->getId()),
+++             uri: sprintf('/api/v2/shop/account/orders/token/payments/%s', $order->getLastPayment()->getId()),

$this->placeOrder('token', $customer->getEmailCanonical());

$this->requestGet(
uri: '/api/v2/shop/orders/token/items',
Copy link
Member

Choose a reason for hiding this comment

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

Why not use nAWw2jewp token, which is commonly used through tests?

);

$response = $this->client->getResponse();
$this->requestGet('/api/v2/shop/customers/' . $customer->getId());
Copy link
Member

Choose a reason for hiding this comment

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

---         $this->requestGet('/api/v2/shop/customers/' . $customer->getId());
+++         $this->requestGet(sprintf('/api/v2/shop/customers/%s', $customer->getId()));

]);

$this->requestPatch(
'/api/v2/shop/customers/reset-password/valid_token',
Copy link
Member

Choose a reason for hiding this comment

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

---             '/api/v2/shop/customers/reset-password/valid_token',
+++             '/api/v2/shop/customers/reset-password/expired_token',

@lchrusciel lchrusciel restored the api-platform-3 branch September 19, 2024 09:18
@lchrusciel lchrusciel deleted the api-platform-3 branch September 19, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintenance CI configurations, READMEs, releases, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants