示例#1
0
 /**
  * setPreferredTerm
  *
  * @since   10 apr 2009
  * @param   KVDthes_Term    $term
  * @return  void
  */
 public function setPreferredTerm(KVDthes_Term $term)
 {
     if ($this->isPreferredTerm() && !$term->isNull()) {
         throw new LogicException('You are trying to set a preferred term for a term which is already a preferred term.');
     }
     $this->checkRelations();
     $it = $this->relations->getUSEIterator();
     $it->rewind();
     if ($it->valid()) {
         $current = $it->current();
         $this->removeRelation($current);
     }
     // Indien de term een NullObject is wissen we de bestaande USE relation maar vervangen we die niet door iets nieuws.
     if (!$term->isNull()) {
         $this->addRelation(new KVDthes_Relation(KVDthes_Relation::REL_USE, $term));
     }
     $this->markDirty();
 }
示例#2
0
 public function testGetUSEIterator()
 {
     $this->object->addRelation($this->relation);
     $this->assertInstanceOf('KVDthes_RelationTypeIterator', $this->object->getUSEIterator());
     $this->assertEquals(count($this->object->getUSEIterator()), 0);
 }