]> git.mxchange.org Git - core.git/commitdiff
Introduce setConfiguredLimit() to SearchCriteria class, this is much better than...
authorRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2011 21:55:19 +0000 (21:55 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2011 21:55:19 +0000 (21:55 +0000)
inc/classes/main/criteria/search/class_SearchCriteria.php
inc/classes/main/reader/class_ConsoleNewsReader.php
inc/classes/main/reader/class_DefaultNewsReader.php

index 3a45b7488d41d986390fabc636cddb3998fb1bc9..c85d24412f9eb16be1e3e96b92655fdec957be4e 100644 (file)
@@ -97,6 +97,18 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria {
                $this->limit = $limit;
        }
 
+       /**
+        * "Setter" for limit from a configuration entry
+        *
+        * @param       $configEntry    The configuration entry which hold a number as limit
+        * @return      void
+        */
+       public final function setConfiguredLimit ($configEntry) {
+               // Get the limit from config entry and set it
+               $limit = $this->getConfigInstance()->getConfigEntry($configEntry);
+               $this->setLimit($limit);
+       }
+
        /**
         * Getter for limit
         *
index c7714874871459c4cb7d171bbdb7d75547ae2fb0..ee5040dcb852355e21f1922a892b76dd34381aaf 100644 (file)
@@ -69,7 +69,7 @@ class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
                $criteriaInstance->addCriteria('page', $command);
 
                // Add limitation from config
-               $criteriaInstance->setLimit($this->getConfigInstance()->getConfigEntry('news_' . $command . '_limit'));
+               $criteriaInstance->setConfiguredLimit('news_' . $command . '_limit');
 
                // Get a resultInstance back from the database
                $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
index f21e6229fc9bc77d0738b7c22a066d5bebe4a349..29c325a3fa80e666633d8af557a7bcf5deae9abd 100644 (file)
@@ -69,7 +69,7 @@ class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Reg
                $criteriaInstance->addCriteria('page', $page);
 
                // Add limitation from config
-               $criteriaInstance->setLimit($this->getConfigInstance()->getConfigEntry('news_' . $page . '_limit'));
+               $criteriaInstance->setConfiguredLimit('news_' . $page . '_limit');
 
                // Get a resultInstance back from the database
                $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);