當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。