Exemplo n.º 1
0
 public function testNotes()
 {
     $this->object->setLoadState(KVDthes_Term::LS_NOTES);
     $this->object->setLoadState(KVDthes_Term::LS_REL);
     $this->object->setLoadState(KVDthes_Term::LS_MATCH);
     $this->object->setScopeNote('SN');
     $this->object->setHistoryNote('HN');
     $this->object->setIndexingNote('IN');
     $this->object->setSourceNote('SoN');
     $this->assertEquals('SN', $this->object->getScopeNote());
     $this->assertEquals('HN', $this->object->getHistoryNote());
     $this->assertEquals('IN', $this->object->getIndexingNote());
     $this->assertEquals('SoN', $this->object->getSourceNote());
 }
Exemplo n.º 2
0
 /**
  * findSubTree
  *
  * @todo    Goede manier zoeken om de load state voor diepere termen correct in te stellen.
  * @param   KVDthes_Term    $termObj
  * @return  KVDthes_Term
  * @throws  KVDdom_DomainObjectNotFoundException - Indien de term niet gevonden werd.
  */
 public function findSubTree(KVDthes_Term $termObj)
 {
     $stmt = $this->conn->prepare($this->getFindSubTreeStatement());
     $stmt->bindValue(1, $termObj->getId(), PDO::PARAM_INT);
     $stmt->bindValue(1, $termObj->getId(), PDO::PARAM_INT);
     $stmt->execute();
     if (!($row = $stmt->fetch(PDO::FETCH_OBJ))) {
         $msg = $this->getReturnType() . " met id {$id} kon niet gevonden worden";
         throw new KVDdom_DomainObjectNotFoundException($msg, $this->getReturnType(), $id);
     }
     $branch = array();
     // Algoritme gaat de lijst af en controleert of er al een object op het bovenliggende niveau zit.
     // Indien wel, dan wordt het bovenliggende object gekoppeld als de BT van het huidige.
     while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
         $current = $this->doLoad($row->id, $row);
         if (isset($branch[$row->depth - 1])) {
             $parent = $branch[$row->depth - 1];
             $current->addRelation(new KVDthes_Relation(KVDthes_Relation::REL_BT, $parent));
         }
         $branch[$row->depth] = $current;
     }
     $termObj->setLoadState(KVDthes_Term::LS_NT);
     return $termObj;
 }