Initial commit
This commit is contained in:
86
local/Beds24/Loop/OrderProductBooking.php
Normal file
86
local/Beds24/Loop/OrderProductBooking.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* Copyright (c) Franck Allimant, CQFDev */
|
||||
/* email : thelia@cqfdev.fr */
|
||||
/* web : http://www.cqfdev.fr */
|
||||
/* */
|
||||
/* For the full copyright and license information, please view the LICENSE */
|
||||
/* file that was distributed with this source code. */
|
||||
/*************************************************************************************/
|
||||
|
||||
/**
|
||||
* Created by Franck Allimant, CQFDev <franck@cqfdev.fr>
|
||||
* Date: 13/06/2019 16:01
|
||||
*/
|
||||
namespace Beds24\Loop;
|
||||
|
||||
use Beds24\Model\Beds24BookingOrderProduct;
|
||||
use Beds24\Model\Beds24BookingOrderProductQuery;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* @method int getCartItem()
|
||||
* @method getOrderProductId()
|
||||
* @method getOrderId()
|
||||
*/
|
||||
class OrderProductBooking extends BaseLoop implements PropelSearchLoopInterface
|
||||
{
|
||||
/**
|
||||
* @return \Thelia\Core\Template\Loop\Argument\ArgumentCollection
|
||||
*/
|
||||
protected function getArgDefinitions()
|
||||
{
|
||||
return new ArgumentCollection(
|
||||
Argument::createIntTypeArgument('order_id'),
|
||||
Argument::createIntTypeArgument('order_product_id')
|
||||
);
|
||||
}
|
||||
|
||||
public function buildModelCriteria()
|
||||
{
|
||||
$query = Beds24BookingOrderProductQuery::create();
|
||||
|
||||
if (null !== $id = $this->getOrderId()) {
|
||||
$query->filterByOrderId($id);
|
||||
}
|
||||
|
||||
if (null !== $id = $this->getOrderProductId()) {
|
||||
$query->filterByOrderProductId($id);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param LoopResult $loopResult
|
||||
* @return LoopResult
|
||||
* @throws \Propel\Runtime\Exception\PropelException
|
||||
*/
|
||||
public function parseResults(LoopResult $loopResult)
|
||||
{
|
||||
/** @var Beds24BookingOrderProduct $item */
|
||||
foreach ($loopResult->getResultDataCollection() as $item) {
|
||||
$loopResultRow = new LoopResultRow($item);
|
||||
|
||||
$loopResultRow
|
||||
->set('BEDS24_BOOKING_ID', $item->getBeds24BookingId())
|
||||
->set('ORDER_ID', $item->getOrderId())
|
||||
->set('ORDER_PRODUCT_ID', $item->getOrderProductId())
|
||||
->set('START_DATE', $item->getStartDate())
|
||||
->set('END_DATE', $item->getEndDate())
|
||||
->set('NUM_ADULTS', $item->getAdults())
|
||||
->set('NUM_CHILDREN', $item->getChildren())
|
||||
;
|
||||
|
||||
$loopResult->addRow($loopResultRow);
|
||||
}
|
||||
|
||||
return $loopResult;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user