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

Cleanup app/etc/di.xml #30886

Open
wants to merge 4 commits into
base: 2.4-develop
Choose a base branch
from
Open

Conversation

thomas-kl1
Copy link
Member

@thomas-kl1 thomas-kl1 commented Nov 11, 2020

Cleanup the app/etc/di.xml that belongs to magento/magento2-base I guess

  • Move some specific di declaration to the module they belongs to.
  • Remove some di declaration which were duplicated.
  • Remove some not necessary di declaration.

Resolved issues:

  1. resolves [Issue] Cleanup app/etc/di.xml #30887: Cleanup app/etc/di.xml

@m2-assistant
Copy link

m2-assistant bot commented Nov 11, 2020

Hi @thomas-kl1. 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.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@sidolov
Copy link
Contributor

sidolov commented Nov 11, 2020

@magento create issue

@thomas-kl1
Copy link
Member Author

@magento run all tests

1 similar comment
@mrtuvn
Copy link
Contributor

mrtuvn commented Feb 5, 2021

@magento run all tests

<argument name="state" xsi:type="object" shared="false">Magento\Framework\Mview\View\StateInterface</argument>
<argument name="changelog" xsi:type="object" shared="false">Magento\Framework\Mview\View\ChangelogInterface</argument>
</arguments>
</type>
<type name="Magento\Catalog\Model\Indexer\Product\Full">
Copy link
Contributor

Choose a reason for hiding this comment

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

why we need remove this ?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch, it shouldn't, didn't seen the shared="false" at first place. I need to investigate the reason to have shared="false"

@@ -1113,7 +1053,7 @@
</type>
<type name="Magento\Framework\Session\Validator">
<arguments>
<argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument>
<argument name="scopeType" xsi:type="const">Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT</argument>
<argument name="skippedUserAgentList" xsi:type="array">
Copy link
Contributor

Choose a reason for hiding this comment

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

argument scopeType should be remove due duplicated in module Store already defined

Copy link
Member Author

Choose a reason for hiding this comment

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

it's overriden in the Magento\Store module, the idea is to separate responsabilities and design scope. app/etc/di.xml should only contain framework di without knowing the context of modules

Copy link
Contributor

@mrtuvn mrtuvn Feb 5, 2021

Choose a reason for hiding this comment

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

no Magento_Store will override this file. File app/etc/di.xml will ultilized first after that is module global di.xml

@@ -485,7 +445,7 @@
<type name="Magento\Framework\Url">
<arguments>
<argument name="session" xsi:type="object">Magento\Framework\Session\Generic\Proxy</argument>
<argument name="scopeType" xsi:type="const">Magento\Store\Model\ScopeInterface::SCOPE_STORE</argument>
<argument name="scopeType" xsi:type="const">Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT</argument>
</arguments>
Copy link
Contributor

Choose a reason for hiding this comment

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

should be Magento\Store\Model\ScopeInterface::SCOPE_STORE

Copy link
Member Author

Choose a reason for hiding this comment

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

@mrtuvn
Copy link
Contributor

mrtuvn commented Feb 5, 2021

In my opinion you only need clean file app/etc/di.xml with remove some parts unneccessary (backslash) is enough

@thomas-kl1
Copy link
Member Author

In my opinion you only need clean file app/etc/di.xml with remove some parts unneccessary (backslash) is enough

app/etc/di declarations should only be framework specific. Anything that belongs to a module should be declared as specific in the module di. THe idea behind that is to get magento2 base module agnostic

@mrtuvn
Copy link
Contributor

mrtuvn commented Feb 9, 2021

Much better seem ok with me !
One more thing i'm not sure this cleanup effort to have consistency across the platform, as in some places we have backslash, in others we don’t. About leading backslash can you update all other place ?
Let's see final tests results

@thomas-kl1
Copy link
Member Author

thomas-kl1 commented Feb 9, 2021

Modules I don't want to touch:

Magento\Ui
Magento\Translation
Magento\MessageQueue
Magento\GraphQl

@thomas-kl1
Copy link
Member Author

@magento run all tests

@thomas-kl1
Copy link
Member Author

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review in Progress
Development

Successfully merging this pull request may close these issues.

[Issue] Cleanup app/etc/di.xml
4 participants