Populates current basket from the saved one.

@return null
496608
public function load()
    {
        $oUser = $this->getBasketUser();
        if (!$oUser) {
            return;
        }

        $oBasket = $oUser->getBasket('savedbasket');

        // restoring from saved history
        $aSavedItems = $oBasket->getItems();
        foreach ($aSavedItems as $oItem) {
            try {
                $oSelList = $oItem->getSelList();

                $this->addToBasket($oItem->oxuserbasketitems__oxartid->value, $oItem->oxuserbasketitems__oxamount->value, $oSelList, $oItem->getPersParams(), true);
            } catch (\OxidEsales\Eshop\Core\Exception\ArticleException $oEx) {
                // caught and ignored
            }
        }
    }
1002756
private function loadItemCounts()
    {
        $storeId     = $this->getStoreId();
        $requestName = $this->searchRequestName;

        $searchRequest = $this->requestBuilder->create(
            $storeId,
            $requestName,
            0,
            0,
            $this->query,
            [],
            $this->filters,
            $this->queryFilters
        );

        $searchResponse = $this->searchEngine->search($searchRequest);

        $this->_totalRecords = $searchResponse->count();
    }
918820
protected function _populate() {
		if ($this->closed() || !$this->_result->valid()) {
			return;
		}
		$data = $this->_result->current();
		$result = $this->_set($data, null, ['exists' => true, 'original' => true]);
		$this->_result->next();

		return $result;
	}
91375
protected function &GetBasketArticles()
    {
        if (is_null($this->oBasketArticles)) {
            $this->oBasketArticles = new TShopBasketArticleList();
        }
        // attach basket as observer - but on first call only
        $this->oBasketArticles->ObserverRegister('oBasketInstance', $this);

        return $this->oBasketArticles;
    }
264668
protected function NextItem()
	{
		if ( $this->empty ) return null;

		/**
		 * @var int $index
		 */
		$index = $this->getCurrentPosition() + 1;
		if ( $index < count( $this->buffer ) )
		{
			return $this->buffer[ $index ];
		}
		else if ( ! $this->filled )
		{
			if ( ! $this->src->getIsFinished() )
			{
				if ( $this->src->MoveNext() )
				{
					$current = $this->src->getCurrent();
					$this->buffer[] = $current;
					return $current;
				}
				else
				{
					$this->filled = true;
				}
			}

			if ( ! count( $this->buffer ) )
			{
				$this->empty = true;
			}
		}

		return null;
	}
864157
protected final void populate() {
		final int size = size();
		mInternalItemList.clear();
		mInternalItemList.ensureCapacity(size);
		for (int a = 0; a < size; a++) {
			mInternalItemList.add(createItem(a));
		}
		mInternalItemDisplayedList = null;
	}
252201
final public function store() {
		
		// hook for tasks to be executed before store
		$this->beforeStore();
		
		// create if object’s keys are populated
		if ($this->areKeysPopulated() and static::exists($this->getId())) {
			$ret = $this->update();
		} else {
			$ret = $this->create();
		}

		// hook for tasks to be executed after store
		$this->afterStore();
		
		return $ret;

	}
667725
protected function populate()
    {
        $this->collection = AnalyticsDb::ADB_STATS_DAILY;

        // $match
        $this->pipeline['$match']['entity'] = $this->entity;
        if (!empty($this->ref)) {
            $this->pipeline['$match']['ref'] = $this->ref;
        }
        $this->pipeline['$match']['ts'] = ['$gte' => $this->dateRange[0], '$lte' => $this->dateRange[1]];

        // $project
        $this->pipeline['$project'] = [
            'count'  => 1,
            'ref'    => 1,
            'ts'     => 1,
            'entity' => 1,
            'month'  => 1,
            'year'   => 1
        ];

        // $group
        $this->pipeline['$group'] = ['_id' => '$ts', 'totalCount' => ['$sum' => '$count']];

        // $sort -> by timestamp
        $this->pipeline['$sort'] = ['_id' => 1];
    }
177431
public function save(){

        foreach($this->_items as $item){
            if($item->exists()){
                $item->save();
            }
        }

        return $this;

    }
176332
protected function _basketDifference(\OxidEsales\Eshop\Application\Model\Basket $oBasket)
    {
        $aDiff = $this->_getReservedItems();
        // refreshing history
        foreach ($oBasket->getContents() as $oItem) {
            $sProdId = $oItem->getProductId();
            if (!isset($aDiff[$sProdId])) {
                $aDiff[$sProdId] = -$oItem->getAmount();
            } else {
                $aDiff[$sProdId] -= $oItem->getAmount();
            }
        }

        return $aDiff;
    }
555515
public function populate()
    {
        $currenciesCodes = [];
        $currencies = $this
            ->currencyRepository
            ->findAll();

        /**
         * Create an array of all active currency codes.
         *
         * @var CurrencyInterface $currency
         */
        foreach ($currencies as $currency) {
            if ($currency->getIso() != $this->defaultCurrency) {
                $currenciesCodes[] = $currency->getIso();
            }
        }

        /**
         * Get rates for all of the enabled and active currencies.
         */
        $rates = $this
            ->currencyExchangeRatesAdapter
            ->getExchangeRates(
                $this->defaultCurrency,
                $currenciesCodes
            );

        /**
         * @var CurrencyInterface $sourceCurrency
         */
        $sourceCurrency = $this
            ->currencyRepository
            ->findOneBy([
                'iso' => $this->defaultCurrency,
            ]);

        /**
         * [
         *      "EUR" => "1,378278",
         *      "YEN" => "0,784937",
         * ].
         */
        foreach ($rates as $code => $rate) {

            /**
             * @var CurrencyInterface $targetCurrency
             */
            $targetCurrency = $this
                ->currencyRepository
                ->findOneBy([
                    'iso' => $code,
                ]);

            if (!($targetCurrency instanceof CurrencyInterface)) {
                continue;
            }

            /**
             * check if this is a new exchange rate, or if we have to
             * create a new one.
             */
            $exchangeRate = $this
                ->currencyExchangeRateObjectDirector
                ->findOneBy([
                    'sourceCurrency' => $sourceCurrency,
                    'targetCurrency' => $targetCurrency,
                ]);

            if (!($exchangeRate instanceof CurrencyExchangeRateInterface)) {
                $exchangeRate = $this
                    ->currencyExchangeRateObjectDirector
                    ->create();
            }

            $exchangeRate
                ->setExchangeRate($rate)
                ->setSourceCurrency($sourceCurrency)
                ->setTargetCurrency($targetCurrency);

            $this
                ->currencyExchangeRateObjectDirector
                ->save($exchangeRate);
        }

        return $this;
    }
995606
public function populate(): void
  {
    foreach ($this->data as $data)
    {
      $this->rowFactory->createRow($this, $data);
    }
  }
1194273
public function reload()
    {
        $freshObject = static::find($this->id());
        $this->getAttributes()->dirty()->resetChanges();
        $this->getAttributes()->setRaw($freshObject->attributes());
        return $this;
    }
582032
public function Init()
    {
        // check basket amount.. remove items that may not be ordered
        $basket = $this->getShopService()->getActiveBasket();
        $global = TGlobal::instance();
        $basket->ValidateBasketContents($global->GetExecutingModulePointer()->sModuleSpotName);
        parent::Init();
    }
205436
function next()
    {
        if (isset($this->_limit) && $this->offset >= $this->_limit)
        {
            return null;
        }
    
        if (!isset($this->data) || ($this->pos >= sizeof($this->data) && $this->truncated))
        {
            $this->loadNextPage();
        }
        
        if ($this->pos < sizeof($this->data))
        {
            $item_data = $this->data[$this->pos];
            $this->pos++;        
            $this->offset++;            
            $cls = $this->item_cls;
            return new $cls($this->api, $item_data, true);
        }
        else
        {
            return null;
        }
    }
631321
public function pop()
    {
        $this->internalDataListUpdate();
        if (isset($this->internalDataListData[0])) {
            $this->internalDataListUpdateValueIfNeeded($this->internalDataListData, sizeof($this->internalDataListData) - 1);
            return array_pop($this->internalDataListData);
        }
        return null;
    }
519483
private function _populate_cache()
    {
        if ($this->_use_json) {
            if (is_readable($this->_cache_file) &&
            ($loaded = @json_decode(Common::getContents($this->_cache_file, ''), true)) && is_array($loaded)) {
                $this->_existing_cache_vals = $loaded;
            }
        } else {
            if (is_readable($this->_cache_file) &&
            ($loaded = @unserialize(Common::getContents($this->_cache_file, false))) && is_array($loaded)) {
                $this->_existing_cache_vals = $loaded;
            }
        }
    }