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


PHP DocumentManager::remove方法代码示例

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


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

示例1: testRemove

 public function testRemove()
 {
     $user = $this->dm->find($this->type, 1);
     $this->dm->remove($user);
     $this->dm->flush();
     $newUser = $this->dm->find($this->type, 1);
     $this->assertNull($newUser);
 }
开发者ID:hlubek,项目名称:couchdb-odm,代码行数:8,代码来源:BasicCrudTest.php

示例2: testDetachWithRemove

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testDetachWithRemove()
 {
     $user = $this->dm->find($this->type, '/functional/user');
     $user->username = "new-name";
     $this->dm->detach($user);
     $this->dm->remove($user);
 }
开发者ID:nicam,项目名称:phpcr-odm,代码行数:10,代码来源:BasicCrudTest.php

示例3: testCascadeRemoveSingleDocument

 public function testCascadeRemoveSingleDocument()
 {
     $user = new \Doctrine\Tests\Models\CMS\CmsUser();
     $user->username = "beberlei";
     $user->name = "Benjamin";
     $article = new \Doctrine\Tests\Models\CMS\CmsArticle();
     $article->text = "foo";
     $article->topic = "bar";
     $article->user = $user;
     $this->dm->persist($article);
     $this->dm->persist($user);
     $this->dm->flush();
     $this->dm->remove($article);
     $this->dm->flush();
     $this->assertFalse($this->dm->contains($user));
     $this->assertFalse($this->dm->contains($article));
 }
开发者ID:doctrine,项目名称:couchdb-odm,代码行数:17,代码来源:CascadeRemoveTest.php

示例4: testRemoveChildParent

 public function testRemoveChildParent()
 {
     $parent = $this->dm->find('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\ChildrenTestObj', '/functional/parent');
     $this->assertCount(4, $parent->allChildren);
     $this->dm->remove($parent);
     $this->dm->flush();
     $this->dm->clear();
     $parent = $this->dm->find('Doctrine\\Tests\\ODM\\PHPCR\\Functional\\ChildrenTestObj', '/functional/parent');
     $this->assertNull($parent);
 }
开发者ID:nicam,项目名称:phpcr-odm,代码行数:10,代码来源:ChildrenTest.php

示例5: testRemoveAndInsertBeforeFlush

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testRemoveAndInsertBeforeFlush()
 {
     $this->dm->clear();
     $user = $this->dm->find($this->type, '/functional/user');
     $this->assertNotNull($user, 'User must exist');
     $this->dm->remove($user);
     $user = new User2();
     $user->username = "test";
     $user->id = '/functional/user';
     $this->dm->persist($user);
 }
开发者ID:richardmiller,项目名称:phpcr-odm,代码行数:14,代码来源:BasicCrudTest.php

示例6: testRemoveThenMove

 public function testRemoveThenMove()
 {
     $this->dm->clear();
     $user = $this->dm->find($this->type, '/functional/lsmith');
     $this->assertNotNull($user, 'User must exist');
     $this->dm->remove($user);
     $this->dm->move($user, '/functional/user2');
     $this->dm->flush();
     $user = $this->dm->find($this->type, '/functional/user2');
     $this->assertNotNull($user, 'User must exist');
     $user = $this->dm->find($this->type, '/functional/lsmith');
     $this->assertNull($user, 'User must be null after deletion');
 }
开发者ID:richardmiller,项目名称:phpcr-odm,代码行数:13,代码来源:MoveTest.php

示例7: testRemove2

 /**
  * Remove the child, check that parent->child is not set afterwards
  */
 public function testRemove2()
 {
     $parent = new ChildTestObj();
     $child = new ChildChildTestObj();
     $parent->name = 'Parent';
     $parent->id = '/functional/childtest';
     $parent->child = $child;
     $child->name = 'Child';
     $this->dm->persist($parent);
     $this->dm->flush();
     $this->dm->clear();
     $child = $this->dm->find($this->childType, '/functional/childtest/test');
     $this->dm->remove($child);
     $this->dm->flush();
     $this->dm->clear();
     $parent = $this->dm->find($this->type, '/functional/childtest');
     $this->assertNull($parent->child);
     $this->assertTrue($this->node->hasNode('childtest'));
     $this->assertFalse($this->node->getNode('childtest')->hasNode('test'));
 }
开发者ID:nicam,项目名称:phpcr-odm,代码行数:23,代码来源:ChildTest.php


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