* @param $controllerName The controller we shall resolve
* @param $appInstance An instance of a manageable application helper class
* @return $resolverInstance The prepared controller resolver instance
- * @throws EmptyVariableException Thrown if the default command is not set
- * @throws InvalidControllerException Thrown if the default controller is invalid
+ * @throws EmptyVariableException Thrown if default command is not set
+ * @throws InvalidControllerException Thrown if default controller is invalid
*/
public final static function createWebControllerResolver ($controllerName, ManageableApplication $appInstance) {
// Create the new instance
throw new InvalidControllerException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
} // END - if
+ // Set default resolver config name
+ $resolverConfigEntry = "";
+
+ // Try to read a config entry for our resolver including controller name... ;-)
+ try {
+ // Create the resolver name
+ $resolverConfigEntry = sprintf("web_cmd_%s_resolver_class", strtolower($controllerName));
+
+ // Get the config, this will throw an exception if there is no special command resolver
+ $resolverClass = $this->getConfigInstance()->readConfig($resolverConfigEntry);
+ } catch (ConfigEntryNotFoundException $e) {
+ // Use default resolver entry
+ $resolverConfigEntry = "web_cmd_resolver_class";
+ }
+
// Initiate the resolver and controller
- $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver_class', array($controllerName, $this->getApplicationInstance()));
+ $resolverInstance = ObjectFactory::createObjectByConfiguredName($resolverConfigEntry, array($controllerName, $this->getApplicationInstance()));
$controllerInstance = ObjectFactory::createObjectByName($this->getClassName(), array($resolverInstance));
- // Remove resolver
+ // Remove resolver (we don't need it anymore)
unset($resolverInstance);
// Return the result