Exemplo n.º 1
0
 public function testSort()
 {
     $rel2 = new KVDthes_Relation(KVDthes_Relation::REL_RT, $this->gebied);
     $rel3 = new KVDthes_Relation(KVDthes_Relation::REL_RT, $this->locatie);
     $this->object->addRelation($this->relation);
     $this->object->addRelation($rel2);
     $this->object->addRelation($rel3);
     $this->object->sort(KVDthes_TermSorter::SORT_TERM);
     $coll = new KVDdom_DomainObjectCollection(array($rel2, $rel3, $this->relation));
     $this->assertEquals($coll, $this->object->getImmutableCollection());
     $this->object->sort(KVDthes_TermSorter::SORT_SORTKEY);
     $this->assertEquals($coll, $this->object->getImmutableCollection());
     $this->object->sort(KVDthes_TermSorter::SORT_QUALTERM);
     $this->assertEquals($coll, $this->object->getImmutableCollection());
     $this->object->sort(KVDthes_TermSorter::SORT_ID);
     $coll = new KVDdom_DomainObjectCollection(array($this->relation, $rel2, $rel3));
     $this->assertEquals($coll, $this->object->getImmutableCollection());
 }
Exemplo n.º 2
0
 /**
  * addRelation
  *
  * @param KVDthes_Relation $relation
  * @return void
  */
 public function addRelation(KVDthes_Relation $relation)
 {
     $this->checkRelations();
     if ($this->relations->addRelation($relation)) {
         //maak de inverse relatie aan
         $relation->getTerm()->addRelation(new KVDthes_Relation($relation->getInverseRelation(), $this));
         $this->markDirty();
     }
 }