// Set resolver instance
$controllerInstance->setResolverInstance($resolverInstance);
- // Generate some pre/post filters
- $controllerInstance->addDoFormPrePostFilters();
+ // We need the controller instance in the resolver class so set it here
+ $resolverInstance->setControllerInstance($controllerInstance);
// Return the prepared instance
return $controllerInstance;
* @return void
*/
public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
- // Run all pre filters
- $this->executePreFilters($requestInstance, $responseInstance);
- $requestInstance->debugInstance();
+ // Get the "form action"
+ $formAction = $requestInstance->getRequestElement('form');
// Get command instance from resolver
- $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
+ $commandInstance = $this->getResolverInstance()->resolveCommand($formAction);
+
+ // Execute *very* generic pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
// Execute the command
$commandInstance->execute($requestInstance, $responseInstance);
- // Run all post filters
+ // Execute *very* generic ppost filters
$this->executePostFilters($requestInstance, $responseInstance);
- // Do something more here
- die("OK");
- }
-
- /**
- * Add some default pre/post filters for this controller to the matching
- * filter chains
- *
- * @return void
- */
- protected function addDoFormPrePostFilters () {
- // Add a filter to check for missing user name
- $this->addPreFilter(UserNameValidatorFilter::createUserNameValidatorFilter());
+ // Flush the buffer out
+ $responseInstance->flushBuffer();
}
}