Loads news stored in DB, filtered by user groups, returns array, filled with
objects, that keeps news data.

@param integer $iFrom  number from which start selecting
@param integer $iLimit Limit of records to fetch from DB(default 0)
502453
public function loadNews($iFrom = 0, $iLimit = 10)
    {
        if ($iLimit) {
            $this->setSqlLimit($iFrom, $iLimit);
        }

        $sNewsViewName = getViewName('oxnews');
        $oBaseObject = $this->getBaseObject();
        $sSelectFields = $oBaseObject->getSelectFields();

        if ($oUser = $this->getUser()) {
            // performance - only join if user is logged in
            $sSelect = "select $sSelectFields from $sNewsViewName ";
            $sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where ";
            $sSelect .= "oxobject2group.oxgroupsid in ( select oxgroupsid from oxobject2group where oxobjectid='" . $oUser->getId() . "' ) or ";
            $sSelect .= "( oxobject2group.oxgroupsid is null ) ";
        } else {
            $sSelect = "select $sSelectFields, oxobject2group.oxgroupsid from $sNewsViewName ";
            $sSelect .= "left join oxobject2group on oxobject2group.oxobjectid=$sNewsViewName.oxid where oxobject2group.oxgroupsid is null ";
        }

        $sSelect .= " and " . $oBaseObject->getSqlActiveSnippet();
        $sSelect .= " and $sNewsViewName.oxshortdesc <> '' ";
        $sSelect .= " group by $sNewsViewName.oxid order by $sNewsViewName.oxdate desc ";

        $this->selectString($sSelect);
    }
338076
public function getSelections($iLimit = null, $aFilter = null)
    {
        $sId = $this->getId() . ((int) $iLimit);
        if (!array_key_exists($sId, self::$_aSelections)) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sSLViewName = getViewName('oxselectlist');

            $sQ = "select {$sSLViewName}.* from oxobject2selectlist join {$sSLViewName} on $sSLViewName.oxid=oxobject2selectlist.oxselnid
                   where oxobject2selectlist.oxobjectid=%s order by oxobject2selectlist.oxsort";

            if (($iLimit = (int) $iLimit)) {
                $sQ .= " limit $iLimit ";
            }

            // vat value for price
            $dVat = 0;
            if (($oPrice = $this->getPrice()) != null) {
                $dVat = $oPrice->getVat();
            }

            // all selectlists this article has
            $oList = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
            $oList->init('oxselectlist');
            $oList->getBaseObject()->setVat($dVat);
            $oList->selectString(sprintf($sQ, $oDb->quote($this->getId())));

            //#1104S if this is variant and it has no selectlists, trying with parent
            if ($oList->count() == 0 && $this->oxarticles__oxparentid->value) {
                $oList->selectString(sprintf($sQ, $oDb->quote($this->oxarticles__oxparentid->value)));
            }

            self::$_aSelections[$sId] = $oList->count() ? $oList : false;
        }

        if (self::$_aSelections[$sId]) {
            // marking active from filter
            $aFilter = ($aFilter === null) ? \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("sel") : $aFilter;
            if ($aFilter) {
                $iSelIdx = 0;
                foreach (self::$_aSelections[$sId] as $oSelection) {
                    if (isset($aFilter[$iSelIdx])) {
                        $oSelection->setActiveSelectionByIndex($aFilter[$iSelIdx]);
                    }
                    $iSelIdx++;
                }
            }
        }

        return self::$_aSelections[$sId];
    }
238017
protected static function _getParams($params, $isInternal = true)
    {

        if (!is_array($params)) {
            $params = array($params);
        }

        $result = array();
        foreach ($params as $param) {
            $optional  = $param->isOptional();
            $paramName = (!$optional ? '*' : '') . $param->name;

            $result[$paramName]['name'] = $param->getName();
            if ($optional && !$isInternal) {
                $result[$paramName]['default'] = $param->getDefaultValue();
            }
            if ($param->allowsNull()) {
                $result[$paramName]['null'] = true;
            }
            if ($param->isArray()) {
                $result[$paramName]['array'] = true;
            }
            if ($param->isPassedByReference()) {
                $result[$paramName]['reference'] = true;
            }
        }

        return $result;
    }
267228
public function loadNewestArticles($iLimit = null)
    {
        //has module?
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if (!$myConfig->getConfigParam('bl_perfLoadPriceForAddList')) {
            $this->getBaseObject()->disablePriceLoad();
        }

        $this->_aArray = [];
        switch ($myConfig->getConfigParam('iNewestArticlesMode')) {
            case 0:
                // switched off, do nothing
                break;
            case 1:
                // manually entered
                $this->loadActionArticles('oxnewest', $iLimit);
                break;
            case 2:
                $sArticleTable = getViewName('oxarticles');
                if ($myConfig->getConfigParam('blNewArtByInsert')) {
                    $sType = 'oxinsert';
                } else {
                    $sType = 'oxtimestamp';
                }
                $sSelect = "select * from $sArticleTable ";
                $sSelect .= "where oxparentid = '' and " . $this->getBaseObject()->getSqlActiveSnippet() . " and oxissearch = 1 order by $sType desc ";
                if (!($iLimit = (int) $iLimit)) {
                    $iLimit = $myConfig->getConfigParam('iNrofNewcomerArticles');
                }
                $sSelect .= "limit " . $iLimit;

                $this->selectString($sSelect);
                break;
        }
    }
519868
public function loadSimilar(
        $limit = ArticleViewDocumentRepository::DEFAULT_LIMIT,
        array $types = null,
        $locale = null,
        $ignoreWebspaces = false
    ) {
        $uuid = null;

        $request = $this->requestStack->getCurrentRequest();

        $articleDocument = $request->get('object');
        if ($articleDocument instanceof ArticleDocument) {
            $uuid = $articleDocument->getUuid();

            if (!$types) {
                $types = [$this->getArticleType($articleDocument)];
            }
        }

        if (!$uuid) {
            throw new ArticleInRequestNotFoundException();
        }

        if (!$locale) {
            $locale = $request->getLocale();
        }

        $webspaceKey = $this->getWebspaceKey($request, $ignoreWebspaces);

        $articleViewDocuments = $this->articleViewDocumentRepository->findSimilar(
            $uuid,
            $limit,
            $types,
            $locale,
            $webspaceKey
        );

        return $this->getResourceItems($articleViewDocuments);
    }
697210
public function load($data, $format = 'php')
    {
        if (!$data) {
            return $this;
        }

        if (\is_string($data) && \in_array($format, static::$formats, true)) {
            switch ($format) {
                case static::FORMAT_YML:
                    $this->loadYaml($data);
                    break;

                case static::FORMAT_JSON:
                    $this->loadJson($data);
                    break;

                case static::FORMAT_INI:
                    $this->loadIni($data);
                    break;

                case static::FORMAT_PHP:
                default:
                    $this->loadArray($data);
                    break;
            }

        } elseif (\is_array($data) || \is_object($data)) {
            $this->bindData($this->data, $data);
        }

        return $this;
    }
621004
protected function _getSeoUrl($sObjectId, $iLang, $iShopId)
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);
        $aInfo = $oDb->getRow("select oxseourl, oxtype from oxseo where oxobjectid =  " . $oDb->quote($sObjectId) . " and oxlang =  " . $oDb->quote($iLang) . " and oxshopid = " . $oDb->quote($iShopId) . " order by oxparams limit 1");
        if ('oxarticle' == $aInfo['oxtype']) {
            $sMainCatId = $oDb->getOne("select oxcatnid from " . getViewName("oxobject2category") . " where oxobjectid = " . $oDb->quote($sObjectId) . " order by oxtime");
            if ($sMainCatId) {
                $sUrl = $oDb->getOne("select oxseourl from oxseo where oxobjectid =  " . $oDb->quote($sObjectId) . " and oxlang =  " . $oDb->quote($iLang) . " and oxshopid = " . $oDb->quote($iShopId) . " and oxparams = " . $oDb->quote($sMainCatId) . "  order by oxexpired");
                if ($sUrl) {
                    return $sUrl;
                }
            }
        }

        return $aInfo['oxseourl'];
    }
1194119
public function get($idOrDocument, $type = Document::DOCUMENT_TYPE_CLASSIFIED) 
    {
        $neobazaarService = $this->getServiceLocator()->get('neobazaar.service.main');
        $classifiedService = $this->getServiceLocator()->get('document.service.classified');
        $documentRepository = $neobazaarService->getDocumentEntityRepository();
		$document = $documentRepository->getEntity($idOrDocument);
		$key = $documentRepository->getEncryptedId($document->getDocumentId());
		$model = null;
        
        switch($type) {
            case Document::DOCUMENT_TYPE_CLASSIFIED:
                // if the user is not Owner or Admin the public model is used
                if(!$classifiedService->checkIfOwnerOrAdmin($document)) {
                    $cache = $this->getServiceLocator()->get('ClassifiedCache');
                    if(!$model = $cache->getItem($key)) {
                        $model = $this->getServiceLocator()->get('document.model.classifiedPublicListing');
                        $model->init($document);
                    }
                } else {
                    $cache = $this->getServiceLocator()->get('ClassifiedCacheOwnerAdmin');
                    if(!$model = $cache->getItem($key)) {
                        $model = $this->getServiceLocator()->get('document.model.classifiedAdminListing');
                        $model->init($document);
                    }
                }
                break;
            case Document::DOCUMENT_TYPE_IMAGE:
            case Document::DOCUMENT_TYPE_PAGE:
            default:
                break;
        }
        
        return $model;
    }
920836
public function getTotalData($field = null, $idValue = null)
	{
	    $select = $this->tableGateway->getSql()->select();
	    
	    if (!empty($field) && !empty($idValue))
	    {
	    	$select->where(array($field => (int) $idValue));
	    }
	    
	    $resultSet = $this->tableGateway->selectWith($select);

	    return $resultSet->count();
	}
244287
public function get($idSite, $period, $date, $segment = false, $columns = false)
    {
        Piwik::checkUserHasViewAccess($idSite);

        $report = ReportsProvider::factory("Actions", "get");
        $archive = Archive::build($idSite, $period, $date, $segment);

        $requestedColumns = Piwik::getArrayFromApiParameter($columns);
        $columns = $report->getMetricsRequiredForReport($allColumns = null, $requestedColumns);

        $inDbColumnNames = array_map(function ($value) { return 'Actions_' . $value; }, $columns);
        $dataTable = $archive->getDataTableFromNumeric($inDbColumnNames);

        $dataTable->deleteColumns(array_diff($requestedColumns, $columns));

        $newNameMapping = array_combine($inDbColumnNames, $columns);
        $dataTable->filter('ReplaceColumnNames', array($newNameMapping));

        $columnsToShow = $requestedColumns ?: $report->getAllMetrics();
        $dataTable->queueFilter('ColumnDelete', array($columnsToRemove = array(), $columnsToShow));

        return $dataTable;
    }
1312054
protected function fetch($fields=[], $limit=NULL, $order=NULL, $offset=NULL, &$count=FALSE)
    {
        if ($limit == self::FETCH_COUNT) {
            return $this->getCount($fields);
        }
        $data = $this->getDataList($fields, $limit, $order, $offset, $count !== FALSE);
        if ($count !== FALSE) {
            $count = $this->fetchCount();
        }
        return $this->resultAsModelList($data);
    }
1158630
public function loadGroupDataByIdentifier($identifier)
    {
        $q = $this->createGroupLoadQuery();
        $q->where(
            $q->expr->eq(
                $this->dbHandler->quoteColumn('name'),
                $q->bindValue($identifier, null, \PDO::PARAM_STR)
            )
        );
        $stmt = $q->prepare();
        $stmt->execute();

        return $stmt->fetchAll(\PDO::FETCH_ASSOC);
    }
1036009
function load($data = [])
    {
        foreach ($this as $k => $v) {
            if ($k == 'table' || $k == 'where') {
                continue;
            }
            if (isset($data[$k])) {
                $this->$k = $data[$k];
            }
        }
    }
323107
public function getOrders($iLimit = false, $iPage = 0)
    {
        $oOrders = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
        $oOrders->init('oxorder');

        if ($iLimit !== false) {
            $oOrders->setSqlLimit($iLimit * $iPage, $iLimit);
        }

        //P
        // Lists does not support loading from two tables, so orders
        // articles now are loaded in account_order.php view and no need to use blLoadProdInfo
        // forcing to load product info which is used in templates
        // $oOrders->aSetBeforeAssign['blLoadProdInfo'] = true;

        //loading order for registered user
        if ($this->oxuser__oxregister->value > 1) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sQ = 'select * from oxorder where oxuserid = ' . $oDb->quote($this->getId()) . ' and oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value) . ' ';
            $sQ = $this->updateGetOrdersQuery($sQ);

            $sQ .= ' order by oxorderdate desc ';
            $oOrders->selectString($sQ);
        }

        return $oOrders;
    }
268176
public function load($path, $module = null, $format = self::DEFAULT_FORMAT)
    {
        $module = $this->_cleanMessage($module);
        $format = $this->_clean($format);
        $path   = realpath($path);

        if ($path && !$this->_storage->get($module . '.' . $format)) {
            $this->_path->add($path, $module);

            if (!in_array($format, ['ini', 'yml', 'php', 'json'], true)) {
                throw new Exception('Undefined format: ' . $format);
            }

            $this->_storage->set($module, $format);
            if ($module !== self::DEFAULT_MODULE) {
                $this->load($path, self::DEFAULT_MODULE, $format);
            }

            return true;
        }

        return false;
    }
824512
private function get_list_or_item($data, $field, $i = null, $default = '')
    {
        $i = ($i === false || count($this->article_ids) > 1 ) ? $i : 0;

        if ($i === null || $i === false) {
            $result = [];
            foreach ($data as $page_id => $item) {
                $result[$page_id] = isset($item[$field]) ? $item[$field] : $default;
            }
            return $result;
        }

        return isset($data[$this->article_ids[$i]][$field]) ? $data[$this->article_ids[$i]][$field] : $default;
    }
987186
public function load(LoaderInterface $loader, $merge = true)
    {
        $this->internalLoad($loader->load(), $merge);
    }