src/snac/server/database/DBUtil.php
/**
     * Populate Constellation source list
     *
     * Source is first-order data, especially as viewed by the Constellation. However, Constellation sources
     * are also "linked" by some SCMs, when an SCM has a citation.
     *
     * This is sort of a wrapper function which is necessary because Constellation objects have multiple
     * source objects in a list. This function is called from selectConstellation() and is specific to the
     * Constellation object.  Thus, this code adds each source to the Constellation. The helper function is
     * populateSourceByID() which can only do a single Source per call.
     *
     * We get a list of Source records from selectSourceIDList() (thus the "List" in the name).  SCM also has
     * a single source, and therefore SCM directly calls populateSourceByID().
     *
     * Constellation version aka version_history.id is always the "newest". If only SCM changed, then
     * constellation version would be the same as the SCM version. Thus we should use $vhInfo['verion'].
     *
     * If something else changed, then the Constellation version is newer than the SCM version, and we
     * should still use the constellation version (because always use the newest version available).
     *
     * @param integer[] $vhInfo associative list with keys 'version', 'ic_id'.
     *
     * @param $cObj \snac\data\Constellation object, passed by reference (as is the default in php for objects
     * as parameters), and changed in place
     */
Populate Constellation source list
Source is first-order data, especially as viewed by the Constellation. However, Constellation sources
are also "linked" by some SCMs, when an SCM has a citation.

This is sort of a wrapper function which is necessary because Constellation objects have multiple
source objects in a list. This function is called from selectConstellation() and is specific to the
Constellation object.  Thus, this code adds each source to the Constellation. The helper function is
populateSourceByID() which can only do a single Source per call.

We get a list of Source records from selectSourceIDList() (thus the "List" in the name).  SCM also has
a single source, and therefore SCM directly calls populateSourceByID().

Constellation version aka version_history.id is always the "newest". If only SCM changed, then
constellation version would be the same as the SCM version. Thus we should use $vhInfo['verion'].

If something else changed, then the Constellation version is newer than the SCM version, and we
should still use the constellation version (because always use the newest version available).

@param integer[] $vhInfo associative list with keys 'version', 'ic_id'.

@param $cObj \snac\data\Constellation object, passed by reference (as is the default in php for objects
as parameters), and changed in place
Populate Constellation source list Source is first - order data especially as viewed by the Constellation . However Constellation sources are also " linked " by some SCMs when an SCM has a citation . This is sort of a wrapper function which is necessary because Constellation objects have multiple source objects in a list . This function is called from selectConstellation () and is specific to the Constellation object . Thus this code adds each source to the Constellation . The helper function is populateSourceByID () which can only do a single Source per call . We get a list of Source records from selectSourceIDList () ( thus the " List " in the name ) . SCM also has a single source and therefore SCM directly calls populateSourceByID () . Constellation version aka version_history . id is always the " newest " . If only SCM changed then constellation version would be the same as the SCM version . Thus we should use $vhInfo [ ' verion ' ] . If something else changed then the Constellation version is newer than the SCM version and we should still use the constellation version ( because always use the newest version available ) . @param integer [] $vhInfo associative list with keys ' version ' ' ic_id ' . @param $cObj \ snac \ data \ Constellation object passed by reference ( as is the default in php for objects as parameters ) and changed in place
private function populateSourceConstellation($vhInfo, $cObj)
    {
        $type = null;
        $types = $this->searchVocabulary("source_type", "simple");
        if (count($types) == 1) {
            $type = $types[0];
        }
        $tableName = 'source';
        $rows = $this->sql->selectSourceList($cObj->getID(), $vhInfo['version']);
        foreach ($rows as $rec)
        {
            $newObj = new \snac\data\Source();
            $newObj->setText($rec['text']);
            $newObj->setCitation($rec['citation']);
            $newObj->setNote($rec['note']);
            $newObj->setURI($rec['uri']);
            $newObj->setDBInfo($rec['version'], $rec['id']);
            $newObj->setType($type);
            $this->populateMeta($vhInfo, $newObj, $tableName);
            $this->populateLanguage($vhInfo, $newObj, $rec['id'], $tableName);
            $cObj->addSource($newObj);
        }
    }
private function populateSourceConstellation ( $ vhInfo , $ cObj ) { $ type = null ; $ types = $ this -> searchVocabulary ( " source_type " , " simple " ) ; if ( count ( $ types ) == 1 ) { $ type = $ types [ 0 ] ; } $ tableName = 'source' ; $ rows = $ this -> sql -> selectSourceList ( $ cObj -> getID ( ) , $ vhInfo [ 'version' ] ) ; foreach ( $ rows as $ rec ) { $ newObj = new \ snac \ data \ Source ( ) ; $ newObj -> setText ( $ rec [ 'text' ] ) ; $ newObj -> setCitation ( $ rec [ 'citation' ] ) ; $ newObj -> setNote ( $ rec [ 'note' ] ) ; $ newObj -> setURI ( $ rec [ 'uri' ] ) ; $ newObj -> setDBInfo ( $ rec [ 'version' ] , $ rec [ 'id' ] ) ; $ newObj -> setType ( $ type ) ; $ this -> populateMeta ( $ vhInfo , $ newObj , $ tableName ) ; $ this -> populateLanguage ( $ vhInfo , $ newObj , $ rec [ 'id' ] , $ tableName ) ; $ cObj -> addSource ( $ newObj ) ; } }
Populate Constellation source list
 Source is first-order data, especially as viewed by the Constellation.
Populate Constellation source list Source is first - order data especially as viewed by the Constellation .
// Set the type to "simple", the default required by Daniel // Constellation version aka version_history.id is always the "newest". See note above. // $newObj->setDisplayName($rec['display_name']); /*
             * setLanguage() is a Language object.
             */