In my custom Module I have a custom UserController
that extends the ZfcUser
vendor's UserController
in order to customize the indexAction
and registerAction
.
namesapce MyModule;
class UserController extends ZfcUser\Controller\UserController
{
public function indexAction() { /* my code */ }
public function registerAction() { /* my code */ }
}
I add the following in my custom Module's module.config.php
:
// some more config
'controllers' => array(
'invokables' => array(
'MyModule\Controller\User' => 'MyModule\Controller\UserController',
),
),
'router' => array(
'routes' => array(
/**
* Overriding zfcuser route
* https://juriansluiman.nl/article/117/use-3rd-party-modules-in-zend-framework-2
*/
'zfcuser' => array(
'options' => array(
// to override the slug
// 'route' => '/profile',
'defaults' => array(
'controller' => 'MyModule\Controller\User',
'action' => 'index',
),
),
'child_routes' => array(
'register' => array(
'options' => array(
'defaults' => array(
'controller' => 'MyModule\Controller\User',
'action' => 'register',
),
),
),
),
),
This gives me
Warning: Missing argument 1 for ZfcUser\Controller\UserController::__construct(), called in C:\xampp\htdocs\my-module\vendor\zendframework\zend-servicemanager\src\AbstractPluginManager.php on line 207 and defined in C:\xampp\htdocs\my-module\vendor\zf-commons\zfc-user\src\ZfcUser\Controller\UserController.php on line 66
And
InvalidArgumentException C:\xampp\htdocs\my-module\vendor\zf-commons\zfc-user\src\ZfcUser\Controller\UserController.php:69 Message: You must supply a callable redirectCallback