Stores $basket in session.

@param BasketInterface $basket
547335
protected function storeInSession(BasketInterface $basket)
    {
        $this->session->set($this->getSessionVarName($basket->getCustomer()), $basket);
    }
246712
private function addProductTwo(Basket $basket)
    {
        $two = $this->products->two();

        $basket->add($two->sku, $two->name, $two->price, function ($product) use ($two) {
            $product->quantity($two->quantity);
        });

        return $basket;
    }
1098178
private function addProductThree(Basket $basket)
    {
        $three = $this->products->three();

        $basket->add($three->sku, $three->name, $three->price, function ($product) use ($three) {
            $product->freebie($three->freebie);
        });

        return $basket;
    }
212555
private function listBasket(Basket $basket)
    {
        $ret = [
            'basket_id' => $basket->getId(),
            'owner' => $this->listUser($basket->getUser()),
            'created_on' => $basket->getCreated()->format(DATE_ATOM),
            'description' => (string) $basket->getDescription(),
            'name' => $basket->getName(),
            'pusher_usr_id'     => $basket->getPusher() ? $basket->getPusher()->getId() : null,
            'pusher'            => $basket->getPusher() ? $this->listUser($basket->getPusher()) : null,
            'updated_on'        => $basket->getUpdated()->format(DATE_ATOM),
            'unread'            => !$basket->isRead(),
            'validation_basket' => !!$basket->getValidation(),
        ];

        if ($basket->getValidation()) {
            $users = array_map(function (ValidationParticipant $participant) {
                $user = $participant->getUser();

                return [
                    'usr_id' => $user->getId(),
                    'usr_name' => $user->getDisplayName(),
                    'confirmed' => $participant->getIsConfirmed(),
                    'can_agree' => $participant->getCanAgree(),
                    'can_see_others' => $participant->getCanSeeOthers(),
                    'readonly' => $user->getId() != $this->getAuthenticatedUser()->getId(),
                    'user' => $this->listUser($user),
                ];
            }, iterator_to_array($basket->getValidation()->getParticipants()));

            $expires_on_atom = NullableDateTime::format($basket->getValidation()->getExpires());

            $ret = array_merge([
                'validation_users'          => $users,
                'expires_on'                => $expires_on_atom,
                'validation_infos'          => $basket->getValidation()
                    ->getValidationString($this->app, $this->getAuthenticatedUser()),
                'validation_confirmed'      => $basket->getValidation()
                    ->getParticipant($this->getAuthenticatedUser())
                    ->getIsConfirmed(),
                'validation_initiator'      => $basket->getValidation()
                    ->isInitiator($this->getAuthenticatedUser()),
                'validation_initiator_user' => $this->listUser($basket->getValidation()->getInitiator()),
            ], $ret);
        }

        return $ret;
    }
472720
public function execute(DataSetInterface $dataSet): void
    {
        $storeTransfer = $this->getStoreByName($dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_STORE]);
        $currencyTransfer = $this->getCurrencyByCode($dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_CURRENCY]);
        $merchantRelationshipTransfer = $this->getMerchantRelationshipByKey(
            $dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_MERCHANT_RELATIONSHIP_KEY]
        );

        if ($dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_SALES_ORDER_THRESHOLD_TYPE_KEY] && $dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_THRESHOLD]) {
            $merchantRelationshipSalesOrderThresholdTransfer = $this->createMerchantRelationshipSalesOrderThresholdTransfer(
                $dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_SALES_ORDER_THRESHOLD_TYPE_KEY],
                $merchantRelationshipTransfer,
                $storeTransfer,
                $currencyTransfer,
                (int)$dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_THRESHOLD],
                (int)$dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_FEE],
                $dataSet[MerchantRelationshipSalesOrderThresholdDataSetInterface::COLUMN_MESSAGE_GLOSSARY_KEY]
            );

            $this->merchantRelationshipSalesOrderThresholdFacade->saveMerchantRelationshipSalesOrderThreshold(
                $merchantRelationshipSalesOrderThresholdTransfer
            );
        }
    }
280216
public function isValidBasketElement(BasketElementInterface $basketElement)
    {
        $product = $basketElement->getProduct();

        if (!$product instanceof ProductInterface) {
            return false;
        }

        return true;
    }
1090741
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);
        $info = $this
            ->getSession()
            ->getInspector()
            ->getSchemas()
            ;
        $this->formatOutput($output, $info);
    }
508293
public function createBasketAccessToken(Basket $basket, User $user)
    {
        return $this->create($user, self::TYPE_VIEW, null, $basket->getId());
    }
394850
public function execute(DataSetInterface $dataSet): void
    {
        $dataSet[PriceProductMerchantRelationshipDataSetInterface::ID_PRICE_PRODUCT_STORE] = $this->getIdPriceProductStoreEntity($dataSet);
    }
5159
public function store(string $key, $object)
    {
        if (isset($this->aliases[$key])) {
            $key = $this->aliases[$key];
        }

        $this->store[$key] = $object;
    }
520080
public function setSession(SessionInterface $session)
    {
        if (!is_object($session) || $this->session !== null) {
            return false;
        }
        
        $this->session = $session;
        
        return true;
    }
658262
public function store($data, $domain)
	{
		$messages   = (array) $this->retrieve($domain);
		$messages[] = $data;

		$this->session->set($this->key($domain), $messages);
	}
346095
protected function setSession(BindingSessionInterface $session)
    {
        $this->session = $session;
        $succinct = $session->get(SessionParameter::BROWSER_SUCCINCT);
        $this->succinct = $succinct ?? true;

        $this->dateTimeFormat = DateTimeFormat::cast($session->get(SessionParameter::BROWSER_DATETIME_FORMAT));
    }
656528
private function deleteBaskets(DatabaseInterface $database)
    {
        $ids = $database->getCol('SELECT oxid FROM oxuserbaskets WHERE oxuserid = ?', [$this->getId()]);
        array_walk($ids, [$this, 'deleteItemById'], \OxidEsales\Eshop\Application\Model\UserBasket::class);
    }
272590
public function Init()
    {
        $basket = $this->getShopService()->getActiveBasket();
        $basket->aCompletedOrderStepList[$this->fieldSystemname] = false;
        $this->CheckBasketContents();

        if (false === $this->AllowAccessToStep(true)) {
            $this->JumpToStep($this->GetPreviousStep());
        }
        if ('basket' !== $this->fieldSystemname && 'thankyou' !== $this->fieldSystemname) {
            $basket->CommitCopyToDatabase(false, $this->fieldSystemname);
        } // commit basket to database...
    }
383896
protected function collectGarbage( SessionInterface $session )
	{
		// Here we will see if this request hits the garbage collection lottery by hitting
		// the odds needed to perform garbage collection on any given request. If we do
		// hit it, we'll call this handler to let it delete all the expired sessions.
		if ( $this->configHitsLottery() )
			$session->getHandler()->gc( $this->getSessionLifetimeInSeconds() );
	}
1320654
public function setQuickCheckoutBasket()
    {
        $oObjectFactory = $this->getObjectFactory();
        $oSession = $this->getSession();

        // Create new temp basket and copy the products to it
        $oCurrentBasket = $oSession->getBasket();
        $oSession->setVariable(self::BESTITAMAZONPAY_TEMP_BASKET, serialize($oCurrentBasket));

        //Reset current basket
        $oSession->setBasket($oObjectFactory->createOxidObject('oxBasket'));
    }