本文整理汇总了PHP中ActiveRecord::clearArrayData方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::clearArrayData方法的具体用法?PHP ActiveRecord::clearArrayData怎么用?PHP ActiveRecord::clearArrayData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::clearArrayData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDefaultZoneVAT
public function testDefaultZoneVAT()
{
$taxRate = TaxRate::getNewInstance(DeliveryZone::getDefaultZoneInstance(), $this->tax, 10);
$taxRate->save();
$order = CustomerOrder::getNewInstance($this->user);
$order->addProduct($this->product, 1, true);
$order->currency->set($this->currency);
$order->save();
$this->assertEqual($order->getTotal(), 100);
$order->finalize();
$this->assertDefaultZoneOrder($order, $this->currency);
ActiveRecord::clearPool();
ActiveRecord::clearArrayData();
$reloaded = CustomerOrder::getInstanceById($order->getID(), true);
/* debug
$reloaded->getShipments();
$arr = $reloaded->toArray();
foreach($arr['cartItems'][0] as $k=>$v)
if(!is_array($v))
echo $k.' : '.$v."\n";
*/
$this->assertDefaultZoneOrder($reloaded, $this->currency);
}
示例2: changeCurrency
public function changeCurrency(Currency $currency, $save = true)
{
$this->currency->set($currency);
foreach ($this->getOrderedItems() as $item) {
$item->price->set($item->getProduct()->getItemPrice($item, true, $currency));
$item->setItemPrice($item->price->get());
if ($save) {
$item->save();
}
}
if ($save) {
$this->save();
}
// otherwise old currency price "sticks" for this request
ActiveRecord::clearArrayData();
}
示例3: loadData
protected function loadData()
{
ActiveRecord::clearArrayData();
$this->data = ActiveRecord::getRecordSetArray($this->table, $this->filter, $this->referencedRecords);
}
示例4: completed
/**
* @role login
*/
public function completed()
{
if ($this->request->isValueSet('id')) {
return new ActionRedirectResponse('checkout', 'completeExternal', array('id' => $this->request->get('id')));
}
ActiveRecord::clearPool();
ActiveRecord::clearArrayData();
$order = CustomerOrder::getInstanceByID((int) $this->session->get('completedOrderID'), CustomerOrder::LOAD_DATA);
$order->getTaxAmount();
$order->loadAll();
$order->getTaxAmount();
ActiveRecord::clearArrayData();
$arr = $order->toArray();
$response = new ActionResponse();
$response->set('order', $arr);
$response->set('url', $this->router->createUrl(array('controller' => 'user', 'action' => 'viewOrder', 'id' => $this->session->get('completedOrderID')), true));
if (!$order->isPaid->get()) {
$transactions = $order->getTransactions()->toArray();
$response->set('transactions', $transactions);
} else {
$response->set('files', ProductFile::getOrderFiles(select(eq('CustomerOrder.ID', $order->getID()))));
}
return $response;
}