Quelques nouveaux fichiers et modules en conf
This commit is contained in:
54
local/modules/OrderComment/Loop/OrderCommentLoop.php
Normal file
54
local/modules/OrderComment/Loop/OrderCommentLoop.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace OrderComment\Loop;
|
||||
|
||||
use OrderComment\Model\OrderCommentQuery;
|
||||
use Thelia\Core\Template\Element\BaseLoop;
|
||||
use Thelia\Core\Template\Element\LoopResult;
|
||||
use Thelia\Core\Template\Element\LoopResultRow;
|
||||
use Thelia\Core\Template\Element\PropelSearchLoopInterface;
|
||||
use Thelia\Core\Template\Loop\Argument\Argument;
|
||||
use Thelia\Core\Template\Loop\Argument\ArgumentCollection;
|
||||
|
||||
class OrderCommentLoop extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('order_id', null, true)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* this method returns a Propel ModelCriteria
|
||||
*
|
||||
* @return \Propel\Runtime\ActiveQuery\ModelCriteria
|
||||
*/
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$orderCommentQuery = OrderCommentQuery::create()->filterByOrderId($this->getOrderId());
|
||||
|
||||
return $orderCommentQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
*
|
||||
* @return LoopResult
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var \OrderComment\Model\OrderComment $orderComment */
|
||||
foreach ($loopResult->getResultDataCollection() as $orderComment) {
|
||||
$loopResultRow = new LoopResultRow($orderComment);
|
||||
|
||||
$loopResultRow->set("ORDER_COMMENT", $orderComment->getComment());
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user