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);
 }
Esempio n. 2
0
 /**
  * @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;
 }
$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');