From: Roland Häder Date: Tue, 29 Mar 2011 21:55:19 +0000 (+0000) Subject: Introduce setConfiguredLimit() to SearchCriteria class, this is much better than... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cdcd82c640a0675ab2de65c9a0d00639fad5eecb;p=core.git Introduce setConfiguredLimit() to SearchCriteria class, this is much better than before now --- diff --git a/inc/classes/main/criteria/search/class_SearchCriteria.php b/inc/classes/main/criteria/search/class_SearchCriteria.php index 3a45b748..c85d2441 100644 --- a/inc/classes/main/criteria/search/class_SearchCriteria.php +++ b/inc/classes/main/criteria/search/class_SearchCriteria.php @@ -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 * diff --git a/inc/classes/main/reader/class_ConsoleNewsReader.php b/inc/classes/main/reader/class_ConsoleNewsReader.php index c7714874..ee5040dc 100644 --- a/inc/classes/main/reader/class_ConsoleNewsReader.php +++ b/inc/classes/main/reader/class_ConsoleNewsReader.php @@ -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); diff --git a/inc/classes/main/reader/class_DefaultNewsReader.php b/inc/classes/main/reader/class_DefaultNewsReader.php index f21e6229..29c325a3 100644 --- a/inc/classes/main/reader/class_DefaultNewsReader.php +++ b/inc/classes/main/reader/class_DefaultNewsReader.php @@ -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);