本文整理汇总了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);
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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');
}
示例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'));
}