I'm attempting to convert my beta DI code to the release version of ZF2. Right now I'm falling over at the very start and there doesn't seem to be any sort of documentation about injecting stuff into the controllers which gets me to think that it's not normal to have dependencies in a controller?
Right now I'm just doing a var_dump('blah');exit;
just to try and get some code to run...
I've tried a number of things and right now I expected this to work:
module.config.php
'controllers' => array(
'invokables' => array(
'indexController' => 'Application\Controller\IndexController',
)
)
Module.php
public function getControllerConfig() {
return array(
'factories' => array(
'indexController' => function(ControllerManager $cm) {
var_dump('blah');exit;
},
),
);
}
Right now nothing is happening and it's pretty frustrating... I read something about creating Factories for each Controller but I have 33 and I find that quite insane and stupid... ?
What I'm trying to inject is stuff like a userMapper for grabbing/saving users. So the registerAction creates a user in the database using the userMapper and when you try to login it uses the userMapper to check if there is a user there etc.