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


PHP BaseModel::unsetChangeLogUnitID方法代码示例

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


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

示例1: saveBundlesForScreen


//.........这里部分代码省略.........
     $this->setMode(ACCESS_WRITE);
     $vb_is_insert = false;
     if ($this->getPrimaryKey()) {
         $this->update();
     } else {
         $this->insert();
         $vb_is_insert = true;
     }
     if ($this->numErrors() > 0) {
         $va_errors = array();
         foreach ($this->errors() as $o_e) {
             switch ($o_e->getErrorNumber()) {
                 case 2010:
                     $po_request->addActionErrors(array($o_e), 'hierarchy_location');
                     break;
                 case 795:
                     // field conflict
                     foreach ($this->getFieldConflicts() as $vs_conflict_field) {
                         $po_request->addActionError($o_e, $vs_conflict_field);
                     }
                     break;
                 case 1100:
                     if ($vs_idno_field = $this->getProperty('ID_NUMBERING_ID_FIELD')) {
                         $po_request->addActionError($o_e, $this->getProperty('ID_NUMBERING_ID_FIELD'));
                     }
                     break;
                 default:
                     $va_errors[] = $o_e;
                     break;
             }
         }
         $po_request->addActionErrors($va_errors);
         if ($vb_is_insert) {
             BaseModel::unsetChangeLogUnitID();
             if ($vb_we_set_transaction) {
                 $this->removeTransaction(false);
             }
             return false;
             // bail on insert error
         }
     }
     if (!$this->getPrimaryKey()) {
         BaseModel::unsetChangeLogUnitID();
         if ($vb_we_set_transaction) {
             $this->removeTransaction(false);
         }
         return false;
     }
     // bail if insert failed
     $this->clearErrors();
     //save reserved elements -  those with a saveElement method
     if (isset($reserved_elements) && is_array($reserved_elements)) {
         foreach ($reserved_elements as $res_element) {
             $res_element_id = $res_element->getPrimaryKey();
             $res_element_datatype = $res_element->get('datatype');
             $res_datatype = Attribute::getValueInstance($res_element_datatype);
             $res_datatype->saveElement($this, $res_element, $vs_form_prefix, $po_request);
         }
     }
     // save preferred labels
     if ($this->getProperty('LABEL_TABLE_NAME')) {
         $vb_check_for_dupe_labels = $this->_CONFIG->get('allow_duplicate_labels_for_' . $this->tableName()) ? false : true;
         $vb_error_inserting_pref_label = false;
         if (is_array($va_fields_by_type['preferred_label'])) {
             foreach ($va_fields_by_type['preferred_label'] as $vs_placement_code => $vs_f) {
                 if (!$vb_batch) {
开发者ID:idiscussforum,项目名称:providence,代码行数:67,代码来源:BundlableLabelableBaseModelWithAttributes.php

示例2: delete

 /**
  *
  */
 public function delete($pb_delete_related = false, $pa_options = null, $pa_fields = null, $pa_table_list = null)
 {
     $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
     if (!$this->inTransaction()) {
         $o_trans = new Transaction($this->getDb());
         $this->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vn_id = $this->getPrimaryKey();
     if (parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list)) {
         // Delete any associated attribute values that use this list item
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\tDELETE FROM ca_attribute_values \n\t\t\t\tWHERE item_id = ?\n\t\t\t", (int) $vn_id))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         // Kill any attributes that no longer have values
         // This cleans up attributes that had a single list value (and now have nothing)
         // in a relatively efficient way
         //
         // We should not need to reindex for search here because the delete of the list item itself
         // should have triggered reindexing
         //
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\tDELETE FROM ca_attributes WHERE attribute_id not in (SELECT distinct attribute_id FROM ca_attribute_values)\n\t\t\t"))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         if ($o_trans) {
             $o_trans->commit();
         }
         if ($vb_web_set_change_log_unit_id) {
             BaseModel::unsetChangeLogUnitID();
         }
         return true;
     }
     if ($o_trans) {
         $o_trans->rollback();
     }
     if ($vb_web_set_change_log_unit_id) {
         BaseModel::unsetChangeLogUnitID();
     }
     return false;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:59,代码来源:ca_list_items.php

示例3: delete

    /**
     * Override delete() to scramble the set_code before we soft-delete. This is useful
     * because the database field has a unique key that really enforces uniqueneness
     * and we might wanna reuse a code of a set we previously deleted.
     */
    public function delete($pb_delete_related = false, $pa_options = null, $pa_fields = null, $pa_table_list = null)
    {
        $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
        if ($pb_delete_related) {
            // quickly delete all labels for all set items in this set
            $this->getDb()->query('DELETE FROM ca_set_item_labels WHERE item_id IN (SELECT item_id FROM ca_set_items WHERE set_id=?)', $this->getPrimaryKey());
            // quickly delete attribute values
            $this->getDb()->query('
				DELETE FROM ca_attribute_values WHERE attribute_id IN
				(SELECT attribute_id FROM ca_attributes WHERE table_num=? and row_id IN (SELECT item_id FROM ca_set_items WHERE set_id=7))
			', $this->tableNum(), $this->getPrimaryKey());
            // quickly delete attributes
            $this->getDb()->query('
				DELETE FROM ca_attributes WHERE table_num=? and row_id IN (SELECT item_id FROM ca_set_items WHERE set_id=7)
			', $this->tableNum(), $this->getPrimaryKey());
            // get list of set item ids
            $qr_items = $this->getDb()->query('SELECT item_id FROM ca_set_items WHERE set_id=?', $this->getPrimaryKey());
            $va_item_ids = $qr_items->getAllFieldValues('item_id');
            // nuke set items
            $this->getDb()->query('DELETE FROM ca_set_items WHERE set_id=?', $this->getPrimaryKey());
            // remove search indexing for deleted set items
            foreach ($va_item_ids as $vn_item_id) {
                $this->getSearchIndexer()->startRowUnIndexing($this->tableNum(), $vn_item_id);
                $this->getSearchIndexer()->commitRowUnIndexing($this->tableNum(), $vn_item_id);
            }
        }
        if ($vn_rc = parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list)) {
            if (!caGetOption('hard', $pa_options, false)) {
                // only applies if we don't hard-delete
                $vb_we_set_transaction = false;
                if (!$this->inTransaction()) {
                    $o_t = new Transaction($this->getDb());
                    $this->setTransaction($o_t);
                    $vb_we_set_transaction = true;
                }
                $this->set('set_code', $this->get('set_code') . '_' . time());
                $this->update(array('force' => true));
                if ($vb_we_set_transaction) {
                    $this->removeTransaction(true);
                }
            }
        }
        if ($vb_web_set_change_log_unit_id) {
            BaseModel::unsetChangeLogUnitID();
        }
        return $vn_rc;
    }
开发者ID:idiscussforum,项目名称:providence,代码行数:52,代码来源:ca_sets.php

示例4: delete

 public function delete($pb_delete_related = false, $pa_options = null, $pa_fields = null, $pa_table_list = null)
 {
     $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
     $o_trans = null;
     if (!$this->inTransaction()) {
         $o_trans = new Transaction($this->getDb());
         $this->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vn_id = $this->getPrimaryKey();
     if (($vn_rc = parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list)) && (!$this->hasField('deleted') || caGetOption('hard', $pa_options, false))) {
         // Delete any associated attributes and attribute_values
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\tDELETE FROM ca_attribute_values \n\t\t\t\t\tUSING ca_attributes \n\t\t\t\t\tINNER JOIN ca_attribute_values ON ca_attribute_values.attribute_id = ca_attributes.attribute_id \n\t\t\t\t\tWHERE ca_attributes.table_num = ? AND ca_attributes.row_id = ?\n\t\t\t\t", array((int) $this->tableNum(), (int) $vn_id)))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\tDELETE FROM ca_attributes\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ttable_num = ? AND row_id = ?\n\t\t\t\t", array((int) $this->tableNum(), (int) $vn_id)))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         //
         // Remove any authority attributes that reference this row
         //
         if ($vn_element_type = (int) AuthorityAttributeValue::tableToElementType($this->tableName())) {
             if ($qr_res = $this->getDb()->query("\n\t\t\t\t\t\tSELECT ca.table_num, ca.row_id FROM ca_attributes ca\n\t\t\t\t\t\tINNER JOIN ca_attribute_values AS cav ON cav.attribute_id = ca.attribute_id \n\t\t\t\t\t\tINNER JOIN ca_metadata_elements AS cme ON cav.element_id = cme.element_id \n\t\t\t\t\t\tWHERE cme.datatype = ? AND cav.value_integer1 = ?\n\t\t\t\t\t", array($vn_element_type, (int) $vn_id))) {
                 $va_ids = array();
                 while ($qr_res->nextRow()) {
                     $va_ids[$qr_res->get('table_num')][] = $qr_res->get('row_id');
                 }
                 if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\t\t\tDELETE FROM ca_attribute_values \n\t\t\t\t\t\t\tUSING ca_metadata_elements \n\t\t\t\t\t\t\tINNER JOIN ca_attribute_values ON ca_attribute_values.element_id = ca_metadata_elements.element_id \n\t\t\t\t\t\t\tWHERE ca_metadata_elements.datatype = ? AND ca_attribute_values.value_integer1 = ?\n\t\t\t\t\t\t", array($vn_element_type, (int) $vn_id)))) {
                     $this->errors = $this->getDb()->errors();
                     if ($o_trans) {
                         $o_trans->rollback();
                     }
                     if ($vb_web_set_change_log_unit_id) {
                         BaseModel::unsetChangeLogUnitID();
                     }
                     return false;
                 } else {
                     $o_indexer = new SearchIndexer($this->getDb());
                     foreach ($va_ids as $vs_table => $va_ids) {
                         $o_indexer->reindexRows($vs_table, $va_ids, array('transaction' => $o_trans));
                     }
                 }
             }
         }
         if ($o_trans) {
             $o_trans->commit();
         }
         if ($vb_web_set_change_log_unit_id) {
             BaseModel::unsetChangeLogUnitID();
         }
         return $vn_rc;
     }
     if ($o_trans) {
         $vn_rc ? $o_trans->commit() : $o_trans->rollback();
     }
     if ($vb_web_set_change_log_unit_id) {
         BaseModel::unsetChangeLogUnitID();
     }
     return $vn_rc;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:76,代码来源:BaseModelWithAttributes.php

示例5: delete

 public function delete($pb_delete_related = false, $pa_options = null, $pa_fields = null, $pa_table_list = null)
 {
     $vb_web_set_change_log_unit_id = BaseModel::setChangeLogUnitID();
     if (!$this->inTransaction()) {
         $o_trans = new Transaction($this->getDb());
         $this->setTransaction($o_trans);
     }
     if (!is_array($pa_options)) {
         $pa_options = array();
     }
     $vn_id = $this->getPrimaryKey();
     if (parent::delete($pb_delete_related, $pa_options, $pa_fields, $pa_table_list)) {
         // Delete any associated attributes and attribute_values
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\tDELETE FROM ca_attribute_values \n\t\t\t\t\tUSING ca_attributes \n\t\t\t\t\tINNER JOIN ca_attribute_values ON ca_attribute_values.attribute_id = ca_attributes.attribute_id \n\t\t\t\t\tWHERE ca_attributes.table_num = ? AND ca_attributes.row_id = ?\n\t\t\t\t", (int) $this->tableNum(), (int) $vn_id))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         if (!($qr_res = $this->getDb()->query("\n\t\t\t\t\tDELETE FROM ca_attributes\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ttable_num = ? AND row_id = ?\n\t\t\t\t", (int) $this->tableNum(), (int) $vn_id))) {
             $this->errors = $this->getDb()->errors();
             if ($o_trans) {
                 $o_trans->rollback();
             }
             if ($vb_web_set_change_log_unit_id) {
                 BaseModel::unsetChangeLogUnitID();
             }
             return false;
         }
         if ($o_trans) {
             $o_trans->commit();
         }
         if ($vb_web_set_change_log_unit_id) {
             BaseModel::unsetChangeLogUnitID();
         }
         return true;
     }
     if ($o_trans) {
         $o_trans->rollback();
     }
     if ($vb_web_set_change_log_unit_id) {
         BaseModel::unsetChangeLogUnitID();
     }
     return false;
 }
开发者ID:guaykuru,项目名称:pawtucket,代码行数:49,代码来源:BaseModelWithAttributes.php


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