Skip to content

magento/magento2#28569:Multi-store: Missing store codes in relation t… #28794

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

Merged
merged 23 commits into from
Jul 15, 2020

Conversation

gallyamov
Copy link
Contributor

Description (*)

This is for #28569

Related Pull Requests

N/A

Fixed Issues (if relevant)

  1. Fixes Multi-store: Missing store codes in relation to a group and website #28569

Manual testing scenarios (*)

Check fixed issue for testing steps and expected results.

Questions or comments

N/A

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Jun 18, 2020

Hi @gallyamov. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@gallyamov
Copy link
Contributor Author

@magento run all tests

@gallyamov
Copy link
Contributor Author

@magento run Functional Tests B2B

@gallyamov gallyamov requested a review from danielrenaud June 18, 2020 14:02
@gallyamov gallyamov marked this pull request as ready for review June 18, 2020 14:02
@gallyamov
Copy link
Contributor Author

@magento run Functional Tests B2B

Copy link
Contributor

@swnsma swnsma left a comment

Choose a reason for hiding this comment

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

Hello @gallyamov!
Please check my comments.

@gallyamov
Copy link
Contributor Author

@magento run all tests

@danielrenaud
Copy link
Contributor

Hi @gallyamov
I'm not sure this is the best approach from a schema perspective. I've opened up an architectural proposal with an alternative approach: magento/architecture#390

@danielrenaud
Copy link
Contributor

danielrenaud commented Jun 23, 2020

@gallyamov Can you please implement this using the schema defined here: magento/architecture#390
It shouldn't affect the underlying implementation much, mainly just the schema

…ebsite

- Implemented new availableStores query

- Code refactor
@gallyamov
Copy link
Contributor Author

@magento run all tests

*/
protected function getStoreConfig($store)
public function getStoreConfig($store)
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need this change, and I would prefer to avoid it

Copy link
Contributor

@danielrenaud danielrenaud Jun 25, 2020

Choose a reason for hiding this comment

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

I know we discussed this offline and thought it might not be a big deal.
However, now the class's api differs from it's interface, and updating the interface would be backwards incompatible.

Copy link
Contributor

Choose a reason for hiding this comment

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

you can cache values in getStoreConfigs, so it fetches data just once
then you can call getStoreConfigs([$store->getCode()]) instead of calling getStoreConfig($store)
It's the same thing

{
$storeConfig = current($this->storeConfigManager->getStoreConfigs([$store->getCode()]));
$storesConfigData = [];
$storeConfigs = $this->storeConfigManager->getStoreConfigs();
Copy link
Contributor

Choose a reason for hiding this comment

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

We should only return available stores for the current website. This is returning all stores for all websites

* @magentoConfigFixture test_store store/information/name Test Store
* @throws Exception
*/
public function testAvailableStoreConfigs(): void
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be in a separate test file since it's testing a different query/resolver

@ghost ghost assigned danielrenaud Jun 24, 2020
@cpartica cpartica added the PAP Partners acceleration program label Jun 25, 2020
…ebsite

- Created separate test for available stores

Added website specific store output
@gallyamov
Copy link
Contributor Author

@magento run all tests

{
$storeConfig = current($this->storeConfigManager->getStoreConfigs([$store->getCode()]));
$websiteStores = $this->storeWebsiteRelation->getWebsiteStores($websiteId, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

you need a (int) typecast, and plz do that int $websiteID in methods, it's the preferred way

@cpartica
Copy link
Contributor

cpartica commented Jul 9, 2020

@gallyamov, FYI "testDefaultWebsiteAvailableStoreConfigs" test is failing

@gallyamov
Copy link
Contributor Author

@magento run all tests

@magento-engcom-team
Copy link
Contributor

Hi @swnsma, thank you for the review.
ENGCOM-7810 has been created to process this Pull Request

@m2-assistant
Copy link

m2-assistant bot commented Jul 15, 2020

Hi @gallyamov, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@okorshenko okorshenko deleted the 28569_adding_stores_to_store_config branch August 25, 2020 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Multi-store: Missing store codes in relation to a group and website
6 participants