- fixed resolving order:
1) application's controller will be checked
2) the application "tests" need its own default news controller
3) else load framework's default news controller
Signed-off-by: Roland Häder <roland@mxchange.org>
$namespace,
$this->getCapitalizedClassPrefix() . StringUtils::convertToClassName($controllerName)
);
$namespace,
$this->getCapitalizedClassPrefix() . StringUtils::convertToClassName($controllerName)
);
- $newsControllerName = sprintf(
+ // Application's default news controller
+ $appDefaultControllerName = sprintf(
'%s\%sDefaultNewsController',
$namespace,
$this->getCapitalizedClassPrefix()
);
'%s\%sDefaultNewsController',
$namespace,
$this->getCapitalizedClassPrefix()
);
-
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('className=%s', $className));
+ // Framework's default news controller
+ $defaultControllerName = sprintf(
+ 'Org\Mxchange\CoreFramework\Controller\News\%sDefaultNewsController',
+ $this->getCapitalizedClassPrefix()
+ );
// Now, let us create the full name of the controller class
// Now, let us create the full name of the controller class
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('className=%s', $className));
$this->setClassName($className);
// Try it hard to get an controller
$this->setClassName($className);
// Try it hard to get an controller
if (class_exists($this->getClassName())) {
// This class does exist. :-)
$isValid = true;
if (class_exists($this->getClassName())) {
// This class does exist. :-)
$isValid = true;
- } elseif ($this->getClassName() != $newsControllerName) {
- // Set default controller
- $this->setClassName($newsControllerName);
+ } elseif ($this->getClassName() != $appDefaultControllerName) {
+ // Set application's default controller
+ $this->setClassName($appDefaultControllerName);
+ } elseif ($this->getClassName() != $defaultControllerName) {
+ // Set framework's default controller
+ $this->setClassName($defaultControllerName);
} else {
// All is tried, give it up here
throw new DefaultControllerException($this, self::EXCEPTION_DEFAULT_CONTROLLER_GONE);
}
} else {
// All is tried, give it up here
throw new DefaultControllerException($this, self::EXCEPTION_DEFAULT_CONTROLLER_GONE);
}
// Return the result
return $isValid;
// Return the result
return $isValid;