<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace ArtabanMarketplace\Loop;

use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;

/**
 * Description of AmpCartId
 *
 * @author LENGY
 */
class AmpCartId extends BaseLoop implements ArraySearchLoopInterface {

    protected function getArgDefinitions() {
        return new ArgumentCollection();
    }

    public function buildArray() {
        return array();
    }

    public function parseResults(LoopResult $loopResult) {
        $cart = $this->getCurrentRequest()->getSession()->getSessionCart($this->getDispatcher());
        $loopResultRow = new LoopResultRow();
        $loopResultRow->set("CART_ID", $cart->getId());
        $loopResult->addRow($loopResultRow);
        return $loopResult;
    }
    /**
     * Return the event dispatcher,
     *
     * @return \Symfony\Component\EventDispatcher\EventDispatcher
     */
    public function getDispatcher()
    {
        return $this->dispatcher;
    }
}
