]> git.mxchange.org Git - mailer.git/blobdiff - inc/classes/main/controller/default/class_WebDefaultNewsController.php
Code sync from ship-simu code (all class config entries must end with _class!)
[mailer.git] / inc / classes / main / controller / default / class_WebDefaultNewsController.php
index 326c0b00bce91ea26f80cb8574aa987aa3190cb5..fee2d39f00034c55f50e7b8828cfb8173245b919 100644 (file)
@@ -51,6 +51,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 +67,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]