本文整理汇总了PHP中Doctrine_Collection::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Collection::delete方法的具体用法?PHP Doctrine_Collection::delete怎么用?PHP Doctrine_Collection::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Collection
的用法示例。
在下文中一共展示了Doctrine_Collection::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testMultiplePrimaryKeys
public function testMultiplePrimaryKeys()
{
$r = new Doctrine_Collection('NestReference');
$r[0]->parent_id = 1;
$r[0]->child_id = 2;
$r[1]->parent_id = 2;
$r[1]->child_id = 3;
$r->save();
$r->delete();
$this->conn->clear();
$q = new Doctrine_Query();
$coll = $q->from('NestReference')->execute();
$this->assertEqual(count($coll), 0);
}
示例2: delete
/**
* @see Doctrine_Collection::delete()
* @return Doctrine_Collection_Cachetaggable
*/
public function delete(Doctrine_Connection $conn = null, $clearColl = true)
{
$returnValue = parent::delete($conn, $clearColl);
$this->removeCacheTags();
return $returnValue;
}
示例3: SortableArticle
$t->info('Test "moveToPosition" method');
$a4 = new SortableArticle();
$a4->name = 'Fourth Article';
$a4->save();
$t->is($a4['position'], 3, 'The new article is placed at the end');
$a4->moveToPosition(1);
doctrine_refresh($a1);
$t->is($a1['position'], 3, 'The 2nd-positioned item has been bumped up');
$t->info('Test deleting a collection of sortable items');
$d1 = new SortableArticle();
$d1->name = 'Article To Delete 1';
$d1->save();
$d2 = new SortableArticle();
$d2->name = 'Article To Delete 2';
$d2->save();
$d3 = new SortableArticle();
$d3->name = 'Article To Delete 3';
$d3->save();
$d4 = new SortableArticle();
$d4->name = 'Article To Delete 4';
$d4->save();
$collection = new Doctrine_Collection('SortableArticle');
$collection[] = $d1;
$collection[] = $d2;
$collection[] = $d3;
$collection[] = $d4;
$collection->delete();
$t->ok(!$d1->exists(), '"Article To Delete 1" has been removed');
$t->ok(!$d2->exists(), '"Article To Delete 2" has been removed');
$t->ok(!$d3->exists(), '"Article To Delete 3" has been removed');
$t->ok(!$d4->exists(), '"Article To Delete 4" has been removed');