本文整理汇总了PHP中ActiveRecord::updateRecordSet方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::updateRecordSet方法的具体用法?PHP ActiveRecord::updateRecordSet怎么用?PHP ActiveRecord::updateRecordSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActiveRecord
的用法示例。
在下文中一共展示了ActiveRecord::updateRecordSet方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveOrder
public function saveOrder()
{
$order = $this->request->get('relatedCategories_' . $this->request->get('id'));
foreach ($order as $key => $value) {
$update = new ARUpdateFilter();
$update->setCondition(new EqualsCond(new ARFieldHandle('CategoryRelationship', 'ID'), $value));
$update->addModifier('position', $key);
ActiveRecord::updateRecordSet('CategoryRelationship', $update);
}
return new JSONResponse(false, 'success');
}
示例2: saveOrder
/**
* Save news entry order
* @role sort
* @return RawResponse
*/
public function saveOrder()
{
$order = array_reverse($this->request->get('typeList_' . $this->request->get('id')));
foreach ($order as $key => $value) {
$update = new ARUpdateFilter();
$update->setCondition(new EqualsCond(new ARFieldHandle('ProductRatingType', 'ID'), $value));
$update->addModifier('position', $key);
ActiveRecord::updateRecordSet('ProductRatingType', $update);
}
return new RawResponse($this->request->get('draggedId'));
}
示例3: saveOrder
/**
* Save news entry order
* @role sort
* @return RawResponse
*/
public function saveOrder()
{
$order = array_reverse($this->request->get('newsList'));
foreach ($order as $key => $value) {
$update = new ARUpdateFilter();
$update->setCondition(new EqualsCond(new ARFieldHandle('NewsPost', 'ID'), $value));
$update->addModifier('position', $key);
ActiveRecord::updateRecordSet('NewsPost', $update);
}
$resp = new RawResponse();
$resp->setContent($this->request->get('draggedId'));
return $resp;
}
示例4: saveOrder
/**
* Save image order
* @return RawResponse
*/
public function saveOrder($order = null)
{
$ownerId = $this->request->get('ownerId');
if ($order === null) {
$varName = array_shift(explode('_', $this->request->get('draggedID')));
$order = array_filter($this->request->get($varName . '_' . $ownerId), array($this, 'filterOrder'));
$order = array_values($order);
}
foreach ($order as $key => $value) {
$update = new ARUpdateFilter();
$update->setCondition(new EqualsCond(new ARFieldHandle($this->getModelClass(), 'ID'), $value));
$update->addModifier('position', $key);
ActiveRecord::updateRecordSet($this->getModelClass(), $update);
}
// set owners main image
if (isset($order[0])) {
$owner = ActiveRecordModel::getInstanceByID($this->getOwnerClass(), $ownerId);
$owner->defaultImage->set(ActiveRecordModel::getInstanceByID($this->getModelClass(), $order[0]));
$owner->save();
}
$resp = new RawResponse();
$resp->setContent($this->request->get('draggedId'));
return $resp;
}
示例5: sortActions
public function sortActions()
{
$order = $this->request->get('actionContainer_' . $this->request->get('conditionId'));
foreach ($order as $key => $value) {
$update = new ARUpdateFilter();
$update->setCondition(new EqualsCond(new ARFieldHandle('DiscountAction', 'ID'), $value));
$update->addModifier('position', $key);
ActiveRecord::updateRecordSet('DiscountAction', $update);
}
$resp = new RawResponse();
$resp->setContent($this->request->get('draggedId'));
return $resp;
}
示例6: processMass
/**
* @role mass
*/
public function processMass()
{
$filter = $this->getSelectFilter();
$act = $this->request->get('act');
$field = array_pop(explode('_', $act, 2));
if ('move' == $act) {
new ActiveGrid($this->application, $filter, $this->getClassName());
$cat = Category::getInstanceById($this->request->get('categoryID'), Category::LOAD_DATA);
$update = new ARUpdateFilter();
$update->setCondition($filter->getCondition());
$update->addModifier('Product.categoryID', $cat->getID());
$update->joinTable('ProductPrice', 'Product', 'productID AND (ProductPrice.currencyID = "' . $this->application->getDefaultCurrencyCode() . '")', 'ID');
ActiveRecord::beginTransaction();
ActiveRecord::updateRecordSet('Product', $update, Product::LOAD_REFERENCES);
Category::recalculateProductsCount();
ActiveRecord::commit();
return new JSONResponse(array('act' => $this->request->get('act')), 'success', $this->translate('_move_succeeded'));
}
// remove design themes
if ('theme' == $act && !$this->request->get('theme')) {
ClassLoader::import('application.model.presentation.CategoryPresentation');
ActiveRecord::deleteRecordSet('CategoryPresentation', new ARDeleteFilter($filter->getCondition()), null, array('Product', 'Category'));
return new JSONResponse(array('act' => $this->request->get('act')), 'success', $this->translate('_themes_removed'));
}
$params = array();
if ('manufacturer' == $act) {
$params['manufacturer'] = Manufacturer::getInstanceByName($this->request->get('manufacturer'));
} else {
if ('price' == $act || 'inc_price' == $act) {
$params['baseCurrency'] = $this->application->getDefaultCurrencyCode();
$params['price'] = $this->request->get($act);
$params['currencies'] = $this->application->getCurrencySet();
$params['inc_price_value'] = $this->request->get('inc_price_value');
$params['inc_quant_price'] = $this->request->get('inc_quant_price');
} else {
if ('addRelated' == $act) {
$params['relatedProduct'] = Product::getInstanceBySKU($this->request->get('related'));
if (!$params['relatedProduct']) {
return new JSONResponse(0);
}
} else {
if ($this->request->get('categoryID')) {
$params['category'] = Category::getInstanceById($this->request->get('categoryID'), Category::LOAD_DATA);
} else {
if ('theme' == $act) {
ClassLoader::import('application.model.presentation.CategoryPresentation');
$params['theme'] = $this->request->get('theme');
} else {
if ('shippingClass' == $act) {
$params['shippingClass'] = $this->request->get('shippingClass');
} else {
if ('taxClass' == $act) {
$params['taxClass'] = $this->request->get('taxClass');
}
}
}
}
}
}
}
$response = parent::processMass($params);
if ($this->request->get('categoryID')) {
Category::recalculateProductsCount();
}
return $response;
}
示例7: cancelFurtherRebills
public function cancelFurtherRebills()
{
return;
$id = $this->getID();
$userID = $this->userID->get()->getID();
$update = new ARUpdateFilter();
$update->setCondition(new OrChainCondition(array(new AndChainCondition(array(new EqualsCond(new ARFieldHandle('CustomerOrder', 'ID'), $id), new EqualsCond(new ARFieldHandle('CustomerOrder', 'userID'), $userID))), new AndChainCondition(array(new EqualsCond(new ARFieldHandle('CustomerOrder', 'parentID'), $id), new EqualsCond(new ARFieldHandle('CustomerOrder', 'userID'), $userID))))));
$update->addModifier('rebillsLeft', '0');
ActiveRecord::updateRecordSet('CustomerOrder', $update);
}
示例8: setDefault
/**
* Sets default language.
* @role status
* @return ActionRedirectResponse
*/
public function setDefault()
{
try {
$r = ActiveRecord::getInstanceByID('Language', $this->request->get('id'), true);
} catch (ARNotFoundException $e) {
return new RawResponse(0);
}
ActiveRecord::beginTransaction();
$update = new ARUpdateFilter();
$update->addModifier('isDefault', 0);
ActiveRecord::updateRecordSet('Language', $update);
$r->setAsDefault(true);
$r->save();
ActiveRecord::commit();
return new ActionRedirectResponse('backend.language', 'index');
}
示例9: registerLastViewed
public static function registerLastViewed($item, $instance = null)
{
$item['position'] = time();
$filter = new ARSelectFilter();
foreach (array('menuID', 'productID', 'userID', 'orderID') as $fieldName) {
if (array_key_exists($fieldName, $item)) {
$filter->setCondition(eq(f(__CLASS__ . '.' . $fieldName), $item[$fieldName]));
break;
// should have only one identificator.
}
}
$items = self::getUserToolbarItems(null, $filter);
if (count($items) > 0) {
// update postion to $item['position'] for first found existing record
$update = new ARUpdateFilter();
$update->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, 'ID'), $items[0]['ID']));
$update->addModifier('position', $item['position']);
ActiveRecord::updateRecordSet(__CLASS__, $update);
} else {
// create new
self::getNewInstance($item)->save();
}
$filter = new ARSelectFilter();
$filter->setLimit(999, BackendToolbarItem::LAST_VIEWED_COUNT);
$items = self::getUserToolbarItems(array(BackendToolbarItem::TYPE_PRODUCT, BackendToolbarItem::TYPE_USER, BackendToolbarItem::TYPE_ORDER), $filter, 'DESC');
if (count($items) > 0) {
foreach ($items as $item) {
ActiveRecord::deleteByID(__CLASS__, $item['ID']);
}
}
return true;
}