/** * setBroaderTerm * * @since 10 apr 2009 * @param KVDthes_Term $term * @return void */ public function setBroaderTerm(KVDthes_Term $term) { if (!$this->isPreferredTerm() && !$term->isNull()) { throw new LogicException('You are trying to set a Broader Term for a term which is not a preferred term.'); } $this->checkRelations(); $it = $this->relations->getBTIterator(); $it->rewind(); if ($it->valid()) { $current = $it->current(); $this->removeRelation($current); } // Indien de term een NullObject is wissen we de bestaande BT relation maar vervangen we die niet door iets nieuws. if (!$term->isNull()) { $this->addRelation(new KVDthes_Relation(KVDthes_Relation::REL_BT, $term)); } $this->markDirty(); }
/** * getIterator * * @param KVDthes_Relations $relations * @return void */ public function getIterator(KVDthes_Relations $relations) { return $relations->getBTIterator(); }
public function testGetBTIterator() { $this->object->addRelation($this->relation); $this->assertInstanceOf('KVDthes_RelationTypeIterator', $this->object->getBTIterator()); $this->assertEquals(count($this->object->getBTIterator()), 0); }