<?php
// Own namespace
-namespace CoreFramework\Reader\News\Console;
+namespace Org\Mxchange\CoreFramework\Reader\News\Console;
// Import framework stuff
-use CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Object\BaseFrameworkSystem;
-use CoreFramework\Reader\News\ReadableNews;
-use CoreFramework\Registry\Registerable;
-use CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Factory\Database\Frontend\DatabaseFrontendFactory;
+use Org\Mxchange\CoreFramework\Factory\Object\ObjectFactory;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Reader\News\ReadableNews;
+use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Request\Requestable;
+use Org\Mxchange\CoreFramework\Traits\Result\Search\SearchableResultTrait;
/**
* A console news reader class reads news from database layer
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2022 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ConsoleNewsReader extends BaseFrameworkSystem implements ReadableNews, Registerable {
+ // Load traits
+ use SearchableResultTrait;
+
/**
* Protected constructor
*
* @return void
*/
- protected function __construct () {
+ private function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
}
// Get a new instance
$readerInstance = new ConsoleNewsReader();
- // Set request instance
- $readerInstance->setRequestInstance($requestInstance);
-
// Return prepared instance
return $readerInstance;
}
*/
public function initializeReader () {
// Get 'command' for saving some calls
- $command = $this->getRequestInstance()->getRequestElement('command');
+ $command = FrameworkBootstrap::getRequestInstance()->getRequestElement('command');
- // First get a wrapper instance
- $wrapperInstance = DatabaseWrapperFactory::createWrapperByConfiguredName('news_db_wrapper_class');
+ // First get a frontend instance
+ $frontendInstance = DatabaseFrontendFactory::createFrontendByConfiguredName('news_db_frontend_class');
// Next create a searchable criteria instance
$criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
$criteriaInstance->setConfiguredLimit('news_' . $command . '_limit');
// Get a resultInstance back from the database
- $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+ $resultInstance = $frontendInstance->doSelectByCriteria($criteriaInstance);
// Save that resultInstance in this class
$this->setResultInstance($resultInstance);