Пример #1
0
 public function testLoadRelation()
 {
     $termType = new KVDthes_TermType('PT', 'voorkeursterm');
     $term2 = new KVDthes_TestTerm(508, $this->sessie, 'kapellen', $termType, 'bouwkundig erfgoed');
     $this->object->loadRelation(new KVDthes_Relation(KVDthes_Relation::REL_RT, $term2));
     $this->object->setLoadState(KVDthes_Term::LS_REL);
     $this->object->setLoadState(KVDthes_Term::LS_MATCH);
     $term2->setLoadState(KVDthes_Term::LS_REL);
     $this->assertEquals(1, count($this->object->getRelations()));
     $this->assertEquals(1, count($term2->getRelations()));
 }
Пример #2
0
 /**
  * loadRelations
  *
  * @param KVDdom_DomainObject $termObj
  * @return KVDdom_DomainObject
  */
 public function loadRelations(KVDthes_Term $termObj)
 {
     $stmt = $this->conn->prepare($this->getLoadRelationsStatement());
     $stmt->bindValue(1, $termObj->getId(), PDO::PARAM_INT);
     $stmt->execute();
     while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
         $termObj->loadRelation(new KVDthes_Relation($row->relation_type, $this->doLoad($row->id_to, $row)));
     }
     $termObj->setLoadState(KVDthes_Term::LS_REL);
     return $termObj;
 }