magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Proposition: Add new property $_objectManager to AbstractHelper

Open U12358 opened this issue 12 years ago • 2 comments

Add new property $_objectManager to class \Magento\App\Helper\AbstractHelper

protected $_objectManager;

p.s. For most useful moving code from controller to block or helper and back, standardization of common approaches.

Line:

$this->_objectManager->get('abc')

must be similar and accessible everywhere.

U12358 avatar Jan 10 '14 08:01 U12358

Direct use of Object Manager in code is bad practice., try avoid this if you can. Better way is use constructor injection.

kandy avatar Jan 10 '14 09:01 kandy

Thanks for new phrase "constructor injection".

Close Issue.

U12358 avatar Jan 10 '14 10:01 U12358