src/snac/server/database/DBUtil.php
/**
     * Read Assertion
     *
     * Reads an assertion out of the database.  Given a bare-bones assertion with the two Constellations and a
     * type, it will read the full assertion out of the database.  If no assertion of that type exists between
     * the two Constellations, then it will return false.
     *
     * If given a handle to the DBUser object, it will also pull back the full User information to include
     * in the assertion for the user that made the assertion.
     *
     * @param \snac\data\Assertion $assertion The bare-bones assertion object to look up
     * @param \snac\server\database\DBUser $uStore optional A handle to the DBUser object to get User information
     * @return \snac\data\Assertion|boolean The complete assertion or false if none exists
     */
Read Assertion
Reads an assertion out of the database.  Given a bare-bones assertion with the two Constellations and a
type, it will read the full assertion out of the database.  If no assertion of that type exists between
the two Constellations, then it will return false.

If given a handle to the DBUser object, it will also pull back the full User information to include
in the assertion for the user that made the assertion.


Read Assertion Reads an assertion out of the database . Given a bare - bones assertion with the two Constellations and a type it will read the full assertion out of the database . If no assertion of that type exists between the two Constellations then it will return false . If given a handle to the DBUser object it will also pull back the full User information to include in the assertion for the user that made the assertion .
function readAssertion(&$assertion, $uStore=null) {
        if ($assertion === null || $assertion->getType() === null || count($assertion->getConstellations()) != 2) {
            return false;
        }
        list($c1, $c2) = $assertion->getConstellations();
        $assertData = $this->sql->readAssertion($assertion->getType(), $c1->getID(), $c2->getID());
        if ($assertData == null) {
            return false;
        }
        $fullAssert = new \snac\data\Assertion();
        $fullAssert->setID($assertData["id"]);
        $fullAssert->setType($assertData["type"]);
        $fullAssert->setText($assertData["assertion"]);
        $fullAssert->setTimestamp($assertData["timestamp"]);
        $user = new \snac\data\User();
        $user->setUserID($assertData["user_id"]);
        if ($uStore !== null) {
            $user = $uStore->readUser($user);
        }
        $fullAssert->setUser($user);
        $fullAssert->addConstellation($this->readConstellation($assertData["ic_id1"], null, DBUtil::$READ_MICRO_SUMMARY));
        $fullAssert->addConstellation($this->readConstellation($assertData["ic_id2"], null, DBUtil::$READ_MICRO_SUMMARY));
        return $fullAssert;
    }
function readAssertion ( & $ assertion , $ uStore = null ) { if ( $ assertion === null || $ assertion -> getType ( ) === null || count ( $ assertion -> getConstellations ( ) ) != 2 ) { return false ; } list ( $ c1 , $ c2 ) = $ assertion -> getConstellations ( ) ; $ assertData = $ this -> sql -> readAssertion ( $ assertion -> getType ( ) , $ c1 -> getID ( ) , $ c2 -> getID ( ) ) ; if ( $ assertData == null ) { return false ; } $ fullAssert = new \ snac \ data \ Assertion ( ) ; $ fullAssert -> setID ( $ assertData [ " id " ] ) ; $ fullAssert -> setType ( $ assertData [ " type " ] ) ; $ fullAssert -> setText ( $ assertData [ " assertion " ] ) ; $ fullAssert -> setTimestamp ( $ assertData [ " timestamp " ] ) ; $ user = new \ snac \ data \ User ( ) ; $ user -> setUserID ( $ assertData [ " user_id " ] ) ; if ( $ uStore !== null ) { $ user = $ uStore -> readUser ( $ user ) ; } $ fullAssert -> setUser ( $ user ) ; $ fullAssert -> addConstellation ( $ this -> readConstellation ( $ assertData [ " ic_id1 " ] , null , DBUtil :: $ READ_MICRO_SUMMARY ) ) ; $ fullAssert -> addConstellation ( $ this -> readConstellation ( $ assertData [ " ic_id2 " ] , null , DBUtil :: $ READ_MICRO_SUMMARY ) ) ; return $ fullAssert ; }
Read Assertion
 Reads an assertion out of the database.
Read Assertion Reads an assertion out of the database .