本文整理汇总了PHP中ActiveRecordModel::updateRecordSet方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecordModel::updateRecordSet方法的具体用法?PHP ActiveRecordModel::updateRecordSet怎么用?PHP ActiveRecordModel::updateRecordSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecordModel
的用法示例。
在下文中一共展示了ActiveRecordModel::updateRecordSet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
protected function insert()
{
$f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('SearchLog', 'keywords'), $this->keywords->get()));
$f->mergeCondition(new EqualsCond(new ARFieldHandle('SearchLog', 'ip'), $this->ip->get()));
if (!ActiveRecordModel::getRecordCount(__CLASS__, $f)) {
parent::insert();
$update = new ARUpdateFilter();
$update->addModifier('time', new ARExpressionHandle('NOW()'));
$update->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'ID'), $this->getID()));
ActiveRecordModel::updateRecordSet(__CLASS__, $update);
}
}
示例2: setSingleAddress
public function setSingleAddress()
{
$f = new ARUpdateFilter(new EqualsCond(new ARFieldHandle('OrderedItem', 'customerOrderID'), $this->order->getID()));
$f->addModifier('OrderedItem.shipmentID', new ARExpressionHandle('NULL'));
ActiveRecordModel::updateRecordSet('OrderedItem', $f);
$this->order->isMultiAddress->set(false);
$this->order->loadAll();
$this->order->mergeItems();
$this->order->resetShipments();
SessionOrder::save($this->order);
$this->order->deleteRelatedRecordSet('Shipment');
return new ActionRedirectResponse('order', 'index');
}
示例3: updateCategoryCounters
public function updateCategoryCounters(ARUpdateFilter $catUpdate, Category $category)
{
if ($catUpdate->isModifierSet()) {
$categoryPathNodes = $category->getPathNodeArray(Category::INCLUDE_ROOT_NODE);
$catIDs = array();
foreach ($categoryPathNodes as $node) {
$catIDs[] = $node['ID'];
}
$catIDs[] = $category->getID();
$catUpdate->setCondition(new INCond(new ARFieldHandle('Category', 'ID'), $catIDs));
ActiveRecordModel::updateRecordSet('Category', $catUpdate);
}
}
示例4: disableRecords
public function disableRecords(ARSelectFilter $filter)
{
if ($disable = $this->getDisableFieldHandle()) {
$update = new ARUpdateFilter($filter->getCondition());
$update->addModifier($disable->toString(), 0);
ActiveRecordModel::updateRecordSet($this->className, $update, $this->getReferencedData());
}
}
示例5: getNextCurrency
public function getNextCurrency()
{
if (!($data = $this->loadRecord('SELECT * FROM ' . $this->getTablePrefix() . 'currency_types ORDER BY sort_order ASC'))) {
return null;
}
if (!($currency = ActiveRecordModel::getInstanceByIDIfExists('Currency', $data['currency_iso_3'], false))) {
$currency = Currency::getNewInstance($data['currency_iso_3']);
$currency->rate->set($data['currency_value']);
}
$currency->isEnabled->set(true);
if ($this->getConfigValue('CONF_DEFAULT_CURRENCY') == $data['CID']) {
$f = new ARUpdateFilter();
$f->addModifier('Currency.isDefault', 0);
ActiveRecordModel::updateRecordSet('Currency', $f);
$currency->isDefault->set(true);
}
return $currency;
}
示例6: move
/**
* @role update
*/
public function move()
{
$page = StaticPage::getInstanceById((int) $this->request->get('id'), StaticPage::LOAD_DATA);
// update parent
if ($this->request->get('parent')) {
$parent = StaticPage::getInstanceById((int) $this->request->get('parent'), StaticPage::LOAD_DATA);
} else {
$parent = null;
}
$page->parent->set($parent);
$page->save();
// update order
$f = new ARUpdateFilter();
if ($parent) {
$f->setCondition(eq(f('StaticPage.parentID'), $parent->getID()));
} else {
$f->setCondition(new IsNullCond(f('StaticPage.parentID')));
}
$f->addModifier('StaticPage.position', new ARExpressionHandle('position+2'));
if ($this->request->get('previous')) {
$previous = StaticPage::getInstanceById((int) $this->request->get('previous'), StaticPage::LOAD_DATA);
$position = $previous->position->get();
$f->mergeCondition(gt(f('StaticPage.position'), $position));
$page->position->set($position + 1);
} else {
$previous = null;
$page->position->set(1);
}
ActiveRecordModel::updateRecordSet('StaticPage', $f);
$page->save();
return new JSONResponse(array(), 'success', $this->translate('_pages_were_successfully_reordered'));
}