X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fcontroller%2Fdefault%2Fclass_WebDefaultNewsController.php;h=f4ef9fbc42b69eaf10823beb92990cc7b85fddf8;hb=12dbc1af8f0bc2981711b17c7c955f270c440b35;hp=326c0b00bce91ea26f80cb8574aa987aa3190cb5;hpb=389f3abad52f9cde3323db5d3d187562fe801a71;p=hub.git diff --git a/inc/classes/main/controller/default/class_WebDefaultNewsController.php b/inc/classes/main/controller/default/class_WebDefaultNewsController.php index 326c0b00b..f4ef9fbc4 100644 --- a/inc/classes/main/controller/default/class_WebDefaultNewsController.php +++ b/inc/classes/main/controller/default/class_WebDefaultNewsController.php @@ -30,12 +30,6 @@ class WebDefaultNewsController extends BaseController implements Controller { protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); - - // Set part description - $this->setObjectDescription("Default controller with news"); - - // Create unique ID number - $this->generateUniqueId(); } /** @@ -51,6 +45,10 @@ class WebDefaultNewsController extends BaseController implements Controller { // Set the command resolver $controllerInstance->setResolverInstance($resolverInstance); + // Add news filters to this controller + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class')); + // Return the prepared instance return $controllerInstance; } @@ -63,32 +61,24 @@ class WebDefaultNewsController extends BaseController implements Controller { * @return void */ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + // Get the command instance from the resolver by sending a request instance to the resolver $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance); - // Load the news here - $this->loadNewsByRequest($requestInstance); - // This request was valid! :-D $requestInstance->requestIsValid(); // Execute the command $commandInstance->execute($requestInstance, $responseInstance); + // Run the pre filters + $this->executePostFilters($requestInstance, $responseInstance); + // Flush the response out $responseInstance->flushBuffer(); } - - /** - * Loads news by a given request - * - * @param $requestInstance An instance of a request class - * @return void - */ - private function loadNewsByRequest (Requestable $requestInstance) { - // Generate a new news object but not carring about which concrete we have - $newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance)->createNewsObject(); - } } // [EOF]