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

Move additional dependencies from private getters to constructor - Magento_Captcha #26398

Conversation

Bartlomiejsz
Copy link
Contributor

@Bartlomiejsz Bartlomiejsz commented Jan 15, 2020

Description (*)

This PR moves additionally introduced dependencies from private getter methods into constructor in Magento_Captcha module.

Manual testing scenarios (*)

Questions or comments

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)

@Bartlomiejsz Bartlomiejsz requested a review from kokoc as a code owner January 15, 2020 11:20
@m2-assistant
Copy link

m2-assistant bot commented Jan 15, 2020

Hi @Bartlomiejsz. 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

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

@Bartlomiejsz Bartlomiejsz force-pushed the feature/dependencies_into_constructor_captcha branch from 850f79b to e500c3d Compare February 8, 2020 23:35
) {
$this->_helper = $helper;
$this->_actionFlag = $actionFlag;
$this->messageManager = $messageManager;
$this->redirect = $redirect;
$this->captchaStringResolver = $captchaStringResolver;
$this->dataPersistor = $dataPersistor;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hello @Bartlomiejsz, thank you for your contribution!

Even if this change doesn't affect a public API, I would recommend to make it as backward compatible as possible, adding the new constructor parameter as last and optional (DataPersistorInterface $dataPersisto = null), with property initialized with object manager if the parameter is not passed.

e.g.

$this->dataPersistor = $dataPersistor ?: ObjectManager::getInstance()->get(DataPeristorInterface::class);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello @aleron75, I can change it if it is required, sure, but I believe this would be great to specify final requirements, because almost each PR is processed differently :)
I.e. #26684 was accepted after modifying constructor to be not backward compatible, and in #26269 I was even asked to modify it and remove object manager usage.
What are your thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me check and get back to you soon, thank you for pointing it out

Copy link
Contributor

Choose a reason for hiding this comment

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

Hello @Bartlomiejsz here I am; I verified and I apologize, you are right: we can accept backward-incompatible changes for non-api classes, so we could add new arguments without fallback to Object Manager.

@aleron75 aleron75 self-assigned this Feb 13, 2020
@aleron75 aleron75 added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Cleanup labels Feb 13, 2020
@magento-engcom-team
Copy link
Contributor

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

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

@engcom-Charlie engcom-Charlie self-assigned this Feb 13, 2020
magento-engcom-team pushed a commit that referenced this pull request Feb 20, 2020
@magento-engcom-team magento-engcom-team merged commit 7f52c56 into magento:2.4-develop Feb 20, 2020
@m2-assistant
Copy link

m2-assistant bot commented Feb 20, 2020

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

@Bartlomiejsz Bartlomiejsz deleted the feature/dependencies_into_constructor_captcha branch June 23, 2020 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Cleanup Component: Captcha Partner: Fast White Cat partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.4
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants