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


PHP ElggEntity::delete方法代碼示例

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


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

示例1: testElggEntityDisableAndEnable

 public function testElggEntityDisableAndEnable()
 {
     global $CONFIG;
     // add annotations and metadata to check if they're disabled.
     $annotation_id = create_annotation($this->entity->guid, 'test_annotation_' . rand(), 'test_value_' . rand());
     $metadata_id = create_metadata($this->entity->guid, 'test_metadata_' . rand(), 'test_value_' . rand());
     $this->assertTrue($this->entity->disable());
     // ensure disabled by comparing directly with database
     $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$this->entity->guid}'");
     $this->assertIdentical($entity->enabled, 'no');
     $annotation = get_data_row("SELECT * FROM {$CONFIG->dbprefix}annotations WHERE id = '{$annotation_id}'");
     $this->assertIdentical($annotation->enabled, 'no');
     $metadata = get_data_row("SELECT * FROM {$CONFIG->dbprefix}metadata WHERE id = '{$metadata_id}'");
     $this->assertIdentical($metadata->enabled, 'no');
     // re-enable for deletion to work
     $this->assertTrue($this->entity->enable());
     // check enabled
     // check annotations and metadata enabled.
     $entity = get_data_row("SELECT * FROM {$CONFIG->dbprefix}entities WHERE guid = '{$this->entity->guid}'");
     $this->assertIdentical($entity->enabled, 'yes');
     $annotation = get_data_row("SELECT * FROM {$CONFIG->dbprefix}annotations WHERE id = '{$annotation_id}'");
     $this->assertIdentical($annotation->enabled, 'yes');
     $metadata = get_data_row("SELECT * FROM {$CONFIG->dbprefix}metadata WHERE id = '{$metadata_id}'");
     $this->assertIdentical($metadata->enabled, 'yes');
     $this->assertTrue($this->entity->delete());
     $this->entity = null;
 }
開發者ID:Twizanex,項目名稱:GuildWoW,代碼行數:27,代碼來源:ElggEntityTest.php

示例2: testPreventRelationshipOnEntityDelete

 public function testPreventRelationshipOnEntityDelete()
 {
     $this->assertTrue(add_entity_relationship($this->entity1->guid, 'test_relationship', $this->entity2->guid));
     $this->assertTrue(add_entity_relationship($this->entity2->guid, 'test_relationship', $this->entity1->guid));
     $guid = $this->entity1->guid;
     elgg_register_event_handler('delete', 'relationship', 'Elgg\\Values::getFalse');
     $this->assertTrue($this->entity1->delete());
     elgg_unregister_event_handler('delete', 'relationship', 'Elgg\\Values::getFalse');
     // relationships should still be gone as there is no entity
     // despite the fact we have a handler trying to prevent it
     $this->assertFalse(check_entity_relationship($guid, 'test_relationship', $this->entity2->guid));
     $this->assertFalse(check_entity_relationship($this->entity2->guid, 'test_relationship', $guid));
 }
開發者ID:cyrixhero,項目名稱:Elgg,代碼行數:13,代碼來源:ElggRelationshipTest.php

示例3: delete

 /**
  * User specific override of the entity delete method.
  *
  * @return bool
  */
 public function delete()
 {
     // Delete owned data
     clear_annotations_by_owner($this->guid);
     clear_metadata_by_owner($this->guid);
     // Delete entity
     return parent::delete();
 }
開發者ID:portokallidis,項目名稱:Metamorphosis-Meducator,代碼行數:13,代碼來源:users.php

示例4: delete

 /**
  * User specific override of the entity delete method.
  *
  * @return bool
  */
 public function delete()
 {
     global $USERNAME_TO_GUID_MAP_CACHE;
     // clear cache
     if (isset($USERNAME_TO_GUID_MAP_CACHE[$this->username])) {
         unset($USERNAME_TO_GUID_MAP_CACHE[$this->username]);
     }
     clear_user_files($this);
     // Delete entity
     return parent::delete();
 }
開發者ID:sephiroth88,項目名稱:Elgg,代碼行數:16,代碼來源:ElggUser.php

示例5: delete

 /**
  * Delete the site.
  *
  * @note You cannot delete the current site.
  *
  * @return bool
  * @throws SecurityException
  */
 public function delete()
 {
     global $CONFIG;
     if ($CONFIG->site->getGUID() == $this->guid) {
         throw new SecurityException('SecurityException:deletedisablecurrentsite');
     }
     return parent::delete();
 }
開發者ID:redvabel,項目名稱:Vabelgg,代碼行數:16,代碼來源:ElggSite.php

示例6: tearDown

 /**
  * Called after each test method.
  */
 public function tearDown()
 {
     $this->entity->delete();
     remove_subtype('object', 'elgg_annotation_test');
     _elgg_services()->hooks = $this->original_hooks;
 }
開發者ID:ibou77,項目名稱:elgg,代碼行數:9,代碼來源:ElggAnnotationTest.php

示例7: delete

 /**
  * User specific override of the entity delete method.
  *
  * @return bool
  */
 public function delete()
 {
     global $USERNAME_TO_GUID_MAP_CACHE, $CODE_TO_GUID_MAP_CACHE;
     // clear cache
     if (isset($USERNAME_TO_GUID_MAP_CACHE[$this->username])) {
         unset($USERNAME_TO_GUID_MAP_CACHE[$this->username]);
     }
     if (isset($CODE_TO_GUID_MAP_CACHE[$this->code])) {
         unset($CODE_TO_GUID_MAP_CACHE[$this->code]);
     }
     // Delete owned data
     clear_annotations_by_owner($this->guid);
     clear_metadata_by_owner($this->guid);
     clear_user_files($this);
     // Delete entity
     return parent::delete();
 }
開發者ID:adamboardman,項目名稱:Elgg,代碼行數:22,代碼來源:users.php

示例8: delete

 /**
  * Delete the site.
  *
  * @note You cannot delete the current site.
  *
  * @return bool
  * @throws SecurityException
  */
 public function delete()
 {
     global $CONFIG;
     if ($CONFIG->site->getGUID() == $this->guid) {
         throw new \SecurityException('You cannot delete the current site');
     }
     return parent::delete();
 }
開發者ID:Twizanex,項目名稱:GuildWoW,代碼行數:16,代碼來源:ElggSite.php


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