Files
le-matelot/local/modules/OrderComment/Loop/SessionOrderCommentLoop.php
2020-01-27 08:56:08 +01:00

37 lines
936 B
PHP

<?php
namespace OrderComment\Loop;
use Thelia\Core\Template\Element\ArraySearchLoopInterface;
use Thelia\Core\Template\Element\BaseLoop;
use Thelia\Core\Template\Element\LoopResult;
use Thelia\Core\Template\Element\LoopResultRow;
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
class SessionOrderCommentLoop extends BaseLoop implements ArraySearchLoopInterface
{
public function buildArray()
{
$item = ['comment' => $this->request->getSession()->get('order-comment')];
return $item;
}
public function parseResults(LoopResult $loopResult)
{
$item = $loopResult->getResultDataCollection();
$loopResultRow = new LoopResultRow();
$loopResultRow->set('ORDER_COMMENT', $item['comment']);
$loopResult->addRow($loopResultRow);
return $loopResult;
}
public function getArgDefinitions()
{
return new ArgumentCollection();
}
}