Allow customization of controller namespace #282

This commit is contained in:
Lorenzo Milesi
2018-10-24 08:06:38 +02:00
parent 5ef46729d0
commit 07699f4197
4 changed files with 19 additions and 2 deletions

View File

@ -24,6 +24,7 @@
- Fix #271: Add closure support for `from` email address; Change default sender to `supportEmail` (bscheshirwork) - Fix #271: Add closure support for `from` email address; Change default sender to `supportEmail` (bscheshirwork)
- Fix #276: Fix missing translatable strings - Fix #276: Fix missing translatable strings
- Enh #249: Show message `email send if possible` any time on reset password request (bscheshirwork) - Enh #249: Show message `email send if possible` any time on reset password request (bscheshirwork)
- Enh #282: Allows customization of controller namespace (maxxer)
## 1.1.4 - February 19, 2018 ## 1.1.4 - February 19, 2018
- Enh: Check enableEmailConfirmation on registration (faenir) - Enh: Check enableEmailConfirmation on registration (faenir)

View File

@ -162,6 +162,14 @@ protected against brute-force attacks, set it to the highest value that is toler
taken to compute the hash doubles for every increment by one of `$blowfishCost`. taken to compute the hash doubles for every increment by one of `$blowfishCost`.
#### consoleControllerNamespace (type: `string`, default: `Da\User\Command`)
Allows customization of the console application controller namespace for the module.
#### controllerNamespace (type: `string`, default: `Da\User\Controller`)
Allows customization of the web application controller namespace for the module.
#### classMap (type: `array`, default: `[]`) #### classMap (type: `array`, default: `[]`)
Configures the definitions of the classes as they have to be override. For more information see Configures the definitions of the classes as they have to be override. For more information see

View File

@ -281,7 +281,7 @@ class Bootstrap implements BootstrapInterface
*/ */
protected function initConsoleCommands(ConsoleApplication $app) protected function initConsoleCommands(ConsoleApplication $app)
{ {
$app->getModule('user')->controllerNamespace = 'Da\User\Command'; $app->getModule('user')->controllerNamespace = $app->getModule('user')->consoleControllerNamespace;
} }
/** /**
@ -291,7 +291,7 @@ class Bootstrap implements BootstrapInterface
*/ */
protected function initControllerNamespace(WebApplication $app) protected function initControllerNamespace(WebApplication $app)
{ {
$app->getModule('user')->controllerNamespace = 'Da\User\Controller'; $app->getModule('user')->controllerNamespace = $app->getModule('user')->controllerNamespace;
$app->getModule('user')->setViewPath('@Da/User/resources/views'); $app->getModule('user')->setViewPath('@Da/User/resources/views');
} }

View File

@ -145,6 +145,14 @@ class Module extends BaseModule
* to compute the hash doubles for every increment by one of $cost * to compute the hash doubles for every increment by one of $cost
*/ */
public $blowfishCost = 10; public $blowfishCost = 10;
/**
* @var string Web controller namespace
*/
public $controllerNamespace = 'Da\User\Controller';
/**
* @var string Console controller namespace
*/
public $consoleControllerNamespace = 'Da\User\Command';
/** /**
* @var array the class map. How the container should load specific classes * @var array the class map. How the container should load specific classes
* @see Bootstrap::buildClassMap() for more details * @see Bootstrap::buildClassMap() for more details