Our Magento store is running community version 2.4.2. I noticed 'registry' is deprecated.intelephense(1007)
notice at several lines in many files. Below is a screenshot of a part of a file that has this notice at different places. Please let me know if it will be fixed when I update the Magento.
2 Answers
A service class as an alternative option for Registry should be a class that gets needed data from the session and passes it for further/later usage. It must not contain any business logic in there – this should be done in the place where data was requested. The short answer is “from the session”. More exactly from Magento\Framework\Session\SessionManager class or any other class that inherits from it – also depends on your needs.
In Magento core there are the following specific sessions on the front-end:
Magento Customer Session – Magento\Customer\Model\Session
Magento Checkout Session – Magento\Checkout\Model\Session
Magento Catalog Session – Magento\Catalog\Model\Session
Newsletter Session – Magento\Newsletter\Model\Session
Here, You can find Alternatives for deprecated Registry class – Magento 2.3 Link
I am not sure It is working with 2.4.3.
Thanks...