public function testCircularEqualSelfReferencingRelationSaving()
 {
     $n1 = new NestTest();
     $n1->set('name', 'node1');
     $n1->save();
     $n2 = new NestTest();
     $n2->set('name', 'node2');
     $n2->save();
     $n1->get('Relatives')->add($n2);
     $n1->save();
     $n2->get('Relatives')->add($n1);
     $n2->save();
     $q = new Doctrine_Query();
     $coll = $q->from('NestReference')->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
     $this->assertEqual(count($coll), 1);
 }
Exemplo n.º 2
0
 public function testNestRelationsSaving()
 {
     $nest = new NestTest();
     $nest->name = 'n 1';
     $nest->Parents[0]->name = 'p 1';
     $nest->Parents[1]->name = 'p 2';
     $nest->Parents[2]->name = 'p 3';
     $nest->Children[0]->name = 'c 1';
     $nest->Children[0]->Children[0]->name = 'c c 1';
     $nest->Children[0]->Children[1]->name = 'c c 2';
     $nest->Children[1]->name = 'c 2';
     $nest->Children[1]->Parents[]->name = 'n 2';
     $nest->save();
     
     $this->connection->clear();
 }