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

Refactor: Improve mview code readability #23240

Conversation

lbajsarowicz
Copy link
Contributor

Description (*)

I found lib/internal/Magento/Framework/Mview/View.php code really annoying to debug / investigate, so that I changed some parts to be more readable, functional.

Fixed Issues (if relevant)

Irrelevant

Manual testing scenarios (*)

  1. Set up your Magento instance to use On schedule reindex
  2. Change product's data
  3. Review the logs to confirm that there are no issues

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 13, 2019

Hi @lbajsarowicz. 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.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

Copy link
Contributor

@ihor-sviziev ihor-sviziev left a comment

Choose a reason for hiding this comment

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

Hi @aredridel,

Changes looks good to me. Let's wait once all tests will be executed, probably some changes still be required.
Once you finish fixing code style and other issues - please squash all your changes into single commit and force push them.

Thank you

// Remove subscriptions
foreach ($this->getSubscriptions() as $subscriptionConfig) {
/** @var View\SubscriptionInterface $subscription */
$subscriptionInstance = $this->subscriptionFactory->create(
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like it could be replaced to $subscriptionInstance = $this->initSubscriptionInstance($subscriptionConfig);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's inconsistency with 'subscription_model' and 'subscriptionModel', however I'll try to handle that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. According to the

$data['subscriptions'][$name] = [
'name' => $name,
'column' => $column,
'subscription_model' => $subscriptionModel
];
- This should be subscription_model not subscriptionModel

@ghost ghost assigned ihor-sviziev Jun 13, 2019
…m), removing try ... catch blocks throwing just caught exception, make use of imports and extract method initializing Subscription, use short-return structure to reduce complexity.
@lbajsarowicz lbajsarowicz force-pushed the refactor/improve-mview-code branch from 933988b to f8078de Compare June 13, 2019 16:10
@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-5291 has been created to process this Pull Request
✳️ @ihor-sviziev, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@engcom-Delta
Copy link
Contributor

✔️ QA Passed

@engcom-Foxtrot engcom-Foxtrot self-assigned this Jun 14, 2019
@magento-engcom-team magento-engcom-team merged commit f8078de into magento:2.3-develop Jun 26, 2019
@m2-assistant
Copy link

m2-assistant bot commented Jun 26, 2019

Hi @lbajsarowicz, 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Component: Mview Partner: Strix partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants