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


PHP ca_objects::removeTransaction方法代码示例

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


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

示例1: removeAllObjects

 /**
  * Unlinks any ca_objects rows related to the currently loaded ca_object_lots record. Note that this does *not*
  * delete the related objects. It only removes their link to this lot.  Note that on error, the database maybe left in 
  * an inconsistent state where some objects are still linked to the lot. If you want to prevent this then wrap your
  * call to removeAllObjects in a transaction and rollback the transaction on error.
  *
  * @return boolean Returns true on success, false if there were errors.
  */
 public function removeAllObjects()
 {
     if (!($vn_lot_id = $this->getPrimaryKey())) {
         return null;
     }
     $o_db = $this->getDb();
     $qr_res = $o_db->query("\n\t\t\t\tSELECT object_id\n\t\t\t\tFROM ca_objects\n\t\t\t\tWHERE\n\t\t\t\t\tlot_id = ? AND deleted = 0\n\t\t\t", (int) $vn_lot_id);
     $t_object = new ca_objects();
     if ($o_t = $this->getTransaction()) {
         $t_object->setTransaction($o_t);
     }
     $vb_errors = false;
     while ($qr_res->nextRow()) {
         if ($t_object->load($qr_res->get('object_id'))) {
             $t_object->setMode(ACCESS_WRITE);
             $t_object->set('lot_id', null);
             $t_object->update();
             if ($t_object->numErrors()) {
                 $this->errors = array_merge($this->errors, $t_object->errors);
                 $vb_errors = true;
             }
         }
     }
     if ($t_object->inTransaction()) {
         $t_object->removeTransaction(true);
     }
     return !$vb_errors;
     // return true if no errors, false if errors
 }
开发者ID:ffarago,项目名称:pawtucket2,代码行数:37,代码来源:ca_object_lots.php


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