]> git.mxchange.org Git - hub.git/blobdiff - inc/classes/main/controller/default/class_WebDefaultNewsController.php
Code merge from latest ship-simu code
[hub.git] / inc / classes / main / controller / default / class_WebDefaultNewsController.php
index ea690a9ec85d13399fadf5d64537cdb4142f8bda..b8bbc05544c0ea0d7482b47de98ed63e1f52d9e8 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class WebDefaultNewsController extends BaseController implements Controller {
-       /**
-        * Instance of a CommandResolver class
-        */
-       private $resolverInstance = null;
-
        /**
         * Protected constructor
         *
@@ -37,13 +32,10 @@ class WebDefaultNewsController extends BaseController implements Controller {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Standart-Controller mit News-Auflistung");
+               $this->setObjectDescription("Default controller with news");
 
                // Create unique ID number
                $this->createUniqueID();
-
-               // Clean up a little
-               $this->removeSystemArray();
        }
 
        /**
@@ -63,16 +55,6 @@ class WebDefaultNewsController extends BaseController implements Controller {
                return $controllerInstance;
        }
 
-       /**
-        * Setter for a command resolver instance
-        *
-        * @param       $resolverInstance       An instance of a command resolver class
-        * @return      void
-        */
-       public final function setResolverInstance (CommandResolver $resolverInstance) {
-               $this->resolverInstance = $resolverInstance;
-       }
-
        /**
         * Handles the given request and response
         *
@@ -82,11 +64,14 @@ class WebDefaultNewsController extends BaseController implements Controller {
         */
        public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the command instance from the resolver by sending a request instance to the resolver
-               $commandInstance = $this->resolverInstance->resolvCommandByRequest($requestInstance);
+               $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);
 
@@ -102,7 +87,7 @@ class WebDefaultNewsController extends BaseController implements Controller {
         */
        private function loadNewsByRequest (Requestable $requestInstance) {
                // Generate a new news object but not carring about which concrete we have
-               $newsInstance = NewsFactory::createFactoryByRequest($requestInstance)->createNewsObject();
+               $newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance)->createNewsObject();
        }
 }