当前位置: 首页>>代码示例>>PHP>>正文


PHP ActiveRecord::deleteByID方法代码示例

本文整理汇总了PHP中ActiveRecord::deleteByID方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveRecord::deleteByID方法的具体用法?PHP ActiveRecord::deleteByID怎么用?PHP ActiveRecord::deleteByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActiveRecord的用法示例。


在下文中一共展示了ActiveRecord::deleteByID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deleteById

 public static function deleteById($id)
 {
     self::deleteCache();
     // make sure the language record exists
     $inst = ActiveRecord::getInstanceById('Language', $id, true);
     // make sure it's not the default currency
     if (true != $inst->isDefault->get()) {
         ActiveRecord::deleteByID('Language', $id);
         return true;
     } else {
         return false;
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:13,代码来源:Language.php

示例2: setAttribute

 /**
  * Sets specification attribute value by mapping product, specification field, and
  * assigned value to one record (atomic item)
  *
  * @param iEavSpecification $specification Specification item value
  */
 public function setAttribute(iEavSpecification $newSpecification)
 {
     $specField = $newSpecification->getFieldInstance();
     $itemClass = $specField->getSelectValueClass();
     if ($this->owner->isExistingRecord() && isset($this->attributes[$newSpecification->getFieldInstance()->getID()]) && ($itemClass == $specField->getSpecificationFieldClass() && $newSpecification->getValue()->isModified())) {
         // Delete old value
         ActiveRecord::deleteByID($itemClass, $this->attributes[$specField->getID()]->getID());
         // And create new
         $this->attributes[$specField->getID()] = call_user_func_array(array($itemClass, 'getNewInstance'), array($this->owner, $specField, $newSpecification->getValue()->get()));
     } else {
         $this->attributes[$specField->getID()] = $newSpecification;
     }
     unset($this->removedAttributes[$specField->getID()]);
 }
开发者ID:saiber,项目名称:www,代码行数:20,代码来源:EavSpecificationManagerCommon.php

示例3: 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;
 }
开发者ID:saiber,项目名称:livecart,代码行数:32,代码来源:BackendToolbarItem.php


注:本文中的ActiveRecord::deleteByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。