当前位置: 首页>>代码示例>>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;未经允许,请勿转载。