마 젠토 2 헬퍼 인스턴스
Magento 2에서 DI 시스템을 둘러싼 머리를 감은 것으로 생각되면 무언가가 나오고 포장이 풀립니다. 핵심 코드에서 도우미에 액세스하는 다른 방법을 봅니다. 예를 들어 다음과 Magento\Catalog\Controller\Category::_initCategory같습니다. if (!$this->_objectManager->get('Magento\Catalog\Helper\Category')->canShow($category)) { return false; } 그러나 Magento\Catalog\Block\Category\View도우미에는 생성자가 주입됩니다. public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\Layer\Category $catalogLayer, \Magento\Framework\Registry $registry, \Magento\Catalog\Helper\Category $categoryHelper, array $data = array() ) …