I have been playing around with Magento 2. There are some things which I don't understand yet. As far as I know so far is that the object manager automatically inserts the right objects to the constuctor. I have some questions regarding this.
I have a controller which extends the following class:
\Magento\Framework\App\Action\Action
When I open this class I see that the __constuctor
class has one argument and it expects to be an instance of the Context
object.
Now for learning purposes i did this to see with is being injected (it doesn't take more then two arguments by default).
public function __construct($a, $b)
{
var_dump(get_class($a));
var_dump(get_class($b));
}
It outputs the following
string(34) "Magento\Backend\App\Action\Context"
string(41) "Magento\Framework\View\Result\PageFactory"
Why are these objects injected? Where can I see which objects I can pass in my constuctor. I couldn't findt any hints in the parent class. I suppose it is dependend on the class I extend?
What happens when I extends below class? And how does the system (and I) know what will be injected?
\Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction
What I am looking for in an answer is not a solution or explaination for this specific example. Moreover I am looking for an overall explaination how I can understand the system better and where I can lookup what I should or must pass as an argument.