src/snac/server/database/DBUtil.php
/**
    * Populate the name cache
    *
    * Gets all the name components and name contributors for the given constellation and stores
    * them in a cache for later use
    *
    * @param string[] $vhInfo Associative array of version information including 'ic_id' and 'version'
    */
Populate the name cache
Gets all the name components and name contributors for the given constellation and stores
them in a cache for later use

@param string[] $vhInfo Associative array of version information including 'ic_id' and 'version'
Populate the name cache Gets all the name components and name contributors for the given constellation and stores them in a cache for later use @param string [] $vhInfo Associative array of version information including ' ic_id ' and ' version '
private function populateNameCache($vhInfo) {
        $this->dataCache["name_entries"] = array();
        $componentRows = $this->sql->selectAllNameComponentsForConstellation($vhInfo["ic_id"], $vhInfo['version']);
        foreach ($componentRows as $component) {
            $cpObj = new \snac\data\NameComponent();
            $cpObj->setText($component['nc_value']);
            $cpObj->setOrder($component['c_order']);
            $cpObj->setType($this->populateTerm($component['nc_label']));
            $cpObj->setDBInfo($component['version'], $component['id']);
            if (!isset($this->dataCache["name_entries"][$component["name_id"]]))
                $this->dataCache["name_entries"][$component["name_id"]] = array();
            if (!isset($this->dataCache["name_entries"][$component["name_id"]]["components"]))
                $this->dataCache["name_entries"][$component["name_id"]]["components"] = array();
            array_push($this->dataCache["name_entries"][$component["name_id"]]["components"], $cpObj);
        }
        $contributorRows = $this->sql->selectAllNameContributorsForConstellation($vhInfo["ic_id"], $vhInfo['version']);
        foreach ($contributorRows as $contributor) {
            $ctObj = new \snac\data\Contributor();
            $ctObj->setType($this->populateTerm($contributor['name_type']));
            $ctObj->setRule($this->populateTerm($contributor['rule']));
            $ctObj->setName($contributor['short_name']);
            $ctObj->setDBInfo($contributor['version'], $contributor['id']);
            if (!isset($this->dataCache["name_entries"][$contributor["name_id"]]))
                $this->dataCache["name_entries"][$contributor["name_id"]] = array();
            if (!isset($this->dataCache["name_entries"][$contributor["name_id"]]["contributors"]))
                $this->dataCache["name_entries"][$contributor["name_id"]]["contributors"] = array();
            array_push($this->dataCache["name_entries"][$contributor["name_id"]]["contributors"], $ctObj);
        }
    }
private function populateNameCache ( $ vhInfo ) { $ this -> dataCache [ " name_entries " ] = array ( ) ; $ componentRows = $ this -> sql -> selectAllNameComponentsForConstellation ( $ vhInfo [ " ic_id " ] , $ vhInfo [ 'version' ] ) ; foreach ( $ componentRows as $ component ) { $ cpObj = new \ snac \ data \ NameComponent ( ) ; $ cpObj -> setText ( $ component [ 'nc_value' ] ) ; $ cpObj -> setOrder ( $ component [ 'c_order' ] ) ; $ cpObj -> setType ( $ this -> populateTerm ( $ component [ 'nc_label' ] ) ) ; $ cpObj -> setDBInfo ( $ component [ 'version' ] , $ component [ 'id' ] ) ; if ( ! isset ( $ this -> dataCache [ " name_entries " ] [ $ component [ " name_id " ] ] ) ) $ this -> dataCache [ " name_entries " ] [ $ component [ " name_id " ] ] = array ( ) ; if ( ! isset ( $ this -> dataCache [ " name_entries " ] [ $ component [ " name_id " ] ] [ " components " ] ) ) $ this -> dataCache [ " name_entries " ] [ $ component [ " name_id " ] ] [ " components " ] = array ( ) ; array_push ( $ this -> dataCache [ " name_entries " ] [ $ component [ " name_id " ] ] [ " components " ] , $ cpObj ) ; } $ contributorRows = $ this -> sql -> selectAllNameContributorsForConstellation ( $ vhInfo [ " ic_id " ] , $ vhInfo [ 'version' ] ) ; foreach ( $ contributorRows as $ contributor ) { $ ctObj = new \ snac \ data \ Contributor ( ) ; $ ctObj -> setType ( $ this -> populateTerm ( $ contributor [ 'name_type' ] ) ) ; $ ctObj -> setRule ( $ this -> populateTerm ( $ contributor [ 'rule' ] ) ) ; $ ctObj -> setName ( $ contributor [ 'short_name' ] ) ; $ ctObj -> setDBInfo ( $ contributor [ 'version' ] , $ contributor [ 'id' ] ) ; if ( ! isset ( $ this -> dataCache [ " name_entries " ] [ $ contributor [ " name_id " ] ] ) ) $ this -> dataCache [ " name_entries " ] [ $ contributor [ " name_id " ] ] = array ( ) ; if ( ! isset ( $ this -> dataCache [ " name_entries " ] [ $ contributor [ " name_id " ] ] [ " contributors " ] ) ) $ this -> dataCache [ " name_entries " ] [ $ contributor [ " name_id " ] ] [ " contributors " ] = array ( ) ; array_push ( $ this -> dataCache [ " name_entries " ] [ $ contributor [ " name_id " ] ] [ " contributors " ] , $ ctObj ) ; } }
Populate the name cache
 Gets all the name components and name contributors for the given constellation and stores
 them in a cache for later use
Populate the name cache Gets all the name components and name contributors for the given constellation and stores them in a cache for later use
// Start with name components // aa.id, aa.name_id, aa.version, aa.nc_label, aa.nc_value, aa.c_order // Then do name contributors