src/snac/server/database/DBUtil.php
/**
     * Populate Term
     *
     * Return a vocabulary term object selected from database using vocabulary id key. \src\snac\data\Term
     * which is used by many objects for controlled vocabulary "terms". We use "term" broadly in the sense of
     * an object that meets all needs of the the user interface.
     *
     * Most of the populate* functions build an object and add it to another existing object. This returns the
     * object, so it might better be called buildTerm() since we have already used that nameing convention.
     *
     * You might be searching for new Term(). This is the only place we create Terms here.
     *
     * @param integer $termID A unique integer record id from the database table vocabulary.
     *
     * @param string $value optional The value of a vocabulary term
     *
     * @param string $type optional The type of a vocabulary term
     *
     * @param string $uri optional The uri of a vocabulary term
     *
     * @return \snac\data\Term The populated term object
     *
     */
Populate Term
Return a vocabulary term object selected from database using vocabulary id key. \src\snac\data\Term
which is used by many objects for controlled vocabulary "terms". We use "term" broadly in the sense of
an object that meets all needs of the the user interface.

Most of the populate* functions build an object and add it to another existing object. This returns the
object, so it might better be called buildTerm() since we have already used that nameing convention.

You might be searching for new Term(). This is the only place we create Terms here.

@param integer $termID A unique integer record id from the database table vocabulary.

@param string $value optional The value of a vocabulary term

@param string $type optional The type of a vocabulary term

@param string $uri optional The uri of a vocabulary term

@return \snac\data\Term The populated term object
Populate Term Return a vocabulary term object selected from database using vocabulary id key . \ src \ snac \ data \ Term which is used by many objects for controlled vocabulary " terms " . We use " term " broadly in the sense of an object that meets all needs of the the user interface . Most of the populate * functions build an object and add it to another existing object . This returns the object so it might better be called buildTerm () since we have already used that nameing convention . You might be searching for new Term () . This is the only place we create Terms here . @param integer $termID A unique integer record id from the database table vocabulary . @param string $value optional The value of a vocabulary term @param string $type optional The type of a vocabulary term @param string $uri optional The uri of a vocabulary term @return \ snac \ data \ Term The populated term object
public function populateTerm($termID, $value=null, $type=null, $uri=null)
    {
        if (isset($termID) && isset($this->termCache[$termID]))
            return $this->termCache[$termID];
        if (isset($termID)) {
            $row = $this->sql->selectTerm($termID);
        } elseif (isset($value) && isset($type)) {
            $row = $this->sql->selectTermByValueAndType($value, $type);
        } elseif (isset($uri)) {
            $row = $this->sql->selectTermByUri($uri);
        }
        if (!isset($row) || empty($row))
            return null;
        $newObj = new \snac\data\Term();
        $newObj->setID($row['id']);
        $newObj->setType($row['type']); 
        $newObj->setTerm($row['value']);
        $newObj->setURI($row['uri']);
        $newObj->setDescription($row['description']);
        $this->termCache[$row['id']] = $newObj;
        return $newObj;
    }
public function populateTerm ( $ termID , $ value = null , $ type = null , $ uri = null ) { if ( isset ( $ termID ) && isset ( $ this -> termCache [ $ termID ] ) ) return $ this -> termCache [ $ termID ] ; if ( isset ( $ termID ) ) { $ row = $ this -> sql -> selectTerm ( $ termID ) ; } elseif ( isset ( $ value ) && isset ( $ type ) ) { $ row = $ this -> sql -> selectTermByValueAndType ( $ value , $ type ) ; } elseif ( isset ( $ uri ) ) { $ row = $ this -> sql -> selectTermByUri ( $ uri ) ; } if ( ! isset ( $ row ) || empty ( $ row ) ) return null ; $ newObj = new \ snac \ data \ Term ( ) ; $ newObj -> setID ( $ row [ 'id' ] ) ; $ newObj -> setType ( $ row [ 'type' ] ) ; $ newObj -> setTerm ( $ row [ 'value' ] ) ; $ newObj -> setURI ( $ row [ 'uri' ] ) ; $ newObj -> setDescription ( $ row [ 'description' ] ) ; $ this -> termCache [ $ row [ 'id' ] ] = $ newObj ; return $ newObj ; }
Populate Term
 Return a vocabulary term object selected from database using vocabulary id key.
Populate Term Return a vocabulary term object selected from database using vocabulary id key .
// If in the cache, then don't re-query // Was setDataType() but this is a vocaulary type. See Term.php. // Save this to the cache /*
         * Class Term has no SNACControlMetadata
         */