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


PHP ca_objects::delete方法代码示例

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


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

示例1: testDelete

 public function testDelete()
 {
     $va_objects = array();
     $this->assertGreaterThan(0, $va_objects[] = $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'dataset'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "My test dataset")))));
     $this->assertGreaterThan(0, $va_objects[] = $this->addTestRecord('ca_objects', array('intrinsic_fields' => array('type_id' => 'physical_object'), 'preferred_labels' => array(array("locale" => "en_US", "name" => "Test physical object")))));
     foreach ($va_objects as $vn_object_id) {
         $t_object = new ca_objects($vn_object_id);
         $t_object->setMode(ACCESS_WRITE);
         $t_object->delete(true, array('hard' => true));
     }
     $o_search = caGetSearchInstance('ca_objects');
     $o_result = $o_search->search('dataset');
     $this->assertEquals(0, $o_result->numHits(), 'dataset should not be indexed anymore');
     $o_result = $o_search->search('physical');
     $this->assertEquals(0, $o_result->numHits(), 'physical object should not be indexed anymore');
 }
开发者ID:samrahman,项目名称:providence,代码行数:16,代码来源:IncrementalIndexingQueryTest.php

示例2: testInsertLoadAndDeleteCycleWithCaObjectsModel

 public function testInsertLoadAndDeleteCycleWithCaObjectsModel()
 {
     $t_list = new ca_lists();
     $va_object_types = $t_list->getItemsForList('object_types');
     $this->assertGreaterThan(0, sizeof($va_object_types), "No object types available");
     $va_object_types = caExtractValuesByUserLocale($va_object_types);
     $this->assertGreaterThan(0, sizeof($va_object_types), "No locale-filtered object types available");
     $vn_locale_id = 1;
     $t_object = new ca_objects();
     $t_object->setMode(ACCESS_WRITE);
     $vn_item_id = 0;
     foreach ($va_object_types as $va_object_type) {
         if (intval($va_object_type['is_enabled']) === 1) {
             $vn_item_id = $va_object_type['item_id'];
         }
     }
     $this->assertGreaterThan(0, $vn_item_id, 'No enabled object type found');
     $t_object->set('type_id', $vn_item_id);
     $t_object->set('locale_id', $vn_locale_id);
     $t_object->set('idno', time());
     $t_object->addAttribute(array('description' => 'Test description', 'locale_id' => $vn_locale_id), 'description');
     $vb_res = $t_object->insert();
     $this->assertTrue($vb_res !== false, 'Insert returned non-true value');
     // insert() returns false OR the primary key, therefore simply asserting $vb_res being true doesn't cut it
     $this->assertEquals($t_object->numErrors(), 0, "Errors on insert: " . join('; ', $t_object->getErrors()));
     $this->opa_test_record_ids['ca_objects'][] = $t_object->getPrimaryKey();
     $vb_res = $t_object->addLabel(array('name' => 'Unit test object'), $vn_locale_id, null, true);
     $this->assertGreaterThan(0, $vb_res, 'AddLabel returned zero value but should return non-zero label_id: ' . join('; ', $t_object->getErrors()));
     $t_object2 = new ca_objects();
     $vb_res = $t_object2->load($t_object->getPrimaryKey());
     $this->assertTrue($vb_res, 'Load of newly created record failed [record does not seem to exist or return row id was invalid?]');
     $this->assertEquals($t_object2->getLabelForDisplay(), 'Unit test object', 'Retrieved row label does not match');
     $this->assertEquals($t_object2->getAttributesForDisplay('description'), 'Test description', 'Retrieved value for attribute "description" does not match expected value');
     // try to search for it
     $o_search = new ObjectSearch();
     $qr_hits = $o_search->search("Unit test object");
     $this->assertGreaterThan(0, $qr_hits->numHits(), 'Search for ca_object by label found no results');
     $vb_found_object = false;
     while ($qr_hits->nextHit()) {
         if ($qr_hits->get('object_id') == $t_object->getPrimaryKey()) {
             $vb_found_object = true;
             break;
         }
     }
     $this->assertTrue($vb_found_object, 'ca_object was not in returned search results for ca_object by label');
     // try delete
     $t_object->delete(true, array('hard' => true));
     $this->assertEquals($t_object->numErrors(), 0, "Errors on delete: " . join('; ', $t_object->getErrors()));
 }
开发者ID:samrahman,项目名称:providence,代码行数:49,代码来源:BundlableLabelableBaseModelWithAttributesTest.php

示例3: tearDown

 public function tearDown()
 {
     // clean up test records
     $t_object = new ca_objects($this->opn_object_id);
     $t_object->setMode(ACCESS_WRITE);
     $vb_del = $t_object->delete(true, array('hard' => true));
     $this->assertTrue($vb_del, 'Deleting the test record shouldnt fail');
     $t_set = new ca_sets($this->opn_set_id);
     $t_set->setMode(ACCESS_WRITE);
     $vb_del = $t_set->delete(true, array('hard' => true));
     $this->assertTrue($vb_del, 'Deleting the test record shouldnt fail');
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:12,代码来源:ca_setsTest.php


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