Error When i load my Helper Class Magento2. it shows
1 exception(s): Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: Wac\DropPin\Helper\Data
app/code/Wac/DropPin/view/frontend/templates/cart/item/default.phtml
echo $this->helper('Wac\DropPin\Helper\Data')->productWeight('Test');
app/code/Wac/DropPin/Helper/Data.php
<?php
namespace Wac\DropPin\Helper;
class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
protected $_productRepository;
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Catalog\Model\ProductRepository $productRepository,
array $data = []
)
{
$this->_productRepository = $productRepository;
parent::__construct($context, $data);
}
public function productWeight($id)
{
return $id;
}
}