Category: Tips, Tricks and Code Snippets

Magento 2 Code Generation – “Incorrect dependency in class”

When running a php bin/magento setup:di:compile you may have at some point run into the “Incorrect dependency in class”¬†errors during the generation of the code. They look a little something like this:   This happens when you include a class in your constructor that is already available inside $context. The solution to this problem is actually quite simple. Instead of… Read more →