當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ca_objects::getDb方法代碼示例

本文整理匯總了PHP中ca_objects::getDb方法的典型用法代碼示例。如果您正苦於以下問題:PHP ca_objects::getDb方法的具體用法?PHP ca_objects::getDb怎麽用?PHP ca_objects::getDb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ca_objects的用法示例。


在下文中一共展示了ca_objects::getDb方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _setCurrent

 /**
  *
  */
 private function _setCurrent($pm_rel_table_name_or_num, $pn_rel_id)
 {
     switch ($this->tableName()) {
         case 'ca_movements':
             // Calcuate current flag for relationships to storage locations and objects
             if (($vs_date_element = $this->getAppConfig()->get('movement_storage_location_date_element')) && ($vs_rel_table = $this->getAppDatamodel()->getTableName($pm_rel_table_name_or_num)) == 'ca_objects') {
                 // get all other movements for this object
                 $t_object = new ca_objects();
                 $t_object->setTransaction($this->getTransaction());
                 if ($t_object->load($pn_rel_id)) {
                     if ($qr_movements_for_object = ca_movements_x_objects::find(array('object_id' => $pn_rel_id), array('returnAs' => 'SearchResult'))) {
                         $va_list = array();
                         while ($qr_movements_for_object->nextHit()) {
                             $va_list[$qr_movements_for_object->get("ca_movements.{$vs_date_element}", array('sortable' => true))] = $qr_movements_for_object->get('ca_movements_x_objects.relation_id');
                         }
                         ksort($va_list, SORT_NUMERIC);
                         $vn_current = array_pop($va_list);
                         if (sizeof($va_list)) {
                             $t_object->getDb()->query("UPDATE ca_movements_x_objects SET source_info = '' WHERE relation_id IN (?)", array(array_values($va_list)));
                             $t_object->getDb()->query("UPDATE ca_movements_x_storage_locations SET source_info = '' WHERE movement_id IN (SELECT movement_id FROM ca_movements_x_objects WHERE relation_id IN (?))", array(array_values($va_list)));
                         }
                         if ($vn_current) {
                             $t_object->getDb()->query("UPDATE ca_movements_x_objects SET source_info = 'current' WHERE relation_id = ?", array($vn_current));
                             $t_object->getDb()->query("UPDATE ca_movements_x_storage_locations SET source_info = 'current' WHERE movement_id IN (SELECT movement_id FROM ca_movements_x_objects WHERE relation_id = ?)", array($vn_current));
                         }
                     }
                 }
             }
             break;
     }
 }
開發者ID:idiscussforum,項目名稱:providence,代碼行數:34,代碼來源:BaseObjectLocationModel.php

示例2: testGetAttributeCount

 public function testGetAttributeCount()
 {
     $t_element = ca_attributes::getElementInstance('internal_notes');
     $this->opt_object->getDb()->dieOnError(true);
     $this->assertEquals(2, ca_attributes::getAttributeCount($this->opt_object->getDb(), $this->opt_object->tableNum(), $this->opt_object->getPrimaryKey(), $t_element->getPrimaryKey()));
 }
開發者ID:samrahman,項目名稱:providence,代碼行數:6,代碼來源:CaAttributesTest.php


注:本文中的ca_objects::getDb方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。