I'm new to magento 2 and I'm trying to understand how exactly injections work in magento.
I understand that injecting a model and interfaces is the right approach in magento 2.
But for some reason when I am trying to inject a model/interface, it throws me and error where as when I use objectManager to get an instance of it, it would work.
For example the below code throws me errors as soon as I inject the eav model or any customer related models or interface.
I was wondering if anyone could elaborate the reason or guide me in the right direction.
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Eav\Model\Entity $entity
) {
$this->_eavEntity = $entity;
parent::__construct($context);
}