src/snac/server/database/DBUtil.php
/**
     * List In Edges for Constellation
     *
     * Lists the Constellations with constellation relations pointing TO the given Constellation.
     *
     * @param  \snac\data\Constellation $constellation The Constellation to search
     * @return mixed[] Associative array of ["constellation"=> micro Constellation, "relation" => Relation ]
     */
List In Edges for Constellation
Lists the Constellations with constellation relations pointing TO the given Constellation.

@param  \snac\data\Constellation $constellation The Constellation to search
@return mixed[] Associative array of ["constellation"=> micro Constellation, "relation" => Relation ]
List In Edges for Constellation Lists the Constellations with constellation relations pointing TO the given Constellation . @param \ snac \ data \ Constellation $constellation The Constellation to search @return mixed [] Associative array of [ " constellation " = > micro Constellation " relation " = > Relation ]
public function listConstellationInEdges(&$constellation) {
        $results = array();
        if ($constellation === null) {
            return $results;
        }
        $edgeList = $this->sql->selectUnversionedConstellationIDsForRelationTarget($constellation->getID());
        foreach ($edgeList as $inEdge) {
            $inC = $this->readPublishedConstellationByID($inEdge["ic_id"], DBUtil::$READ_MICRO_SUMMARY|DBUtil::$READ_RELATIONS);
            $inR = null;
            foreach ($inC->getRelations() as $rel) {
                if ($rel->getID() == $inEdge["id"] && $rel->getTargetConstellation() !== null
                        && $rel->getTargetConstellation() == $constellation->getID()) {
                    $inR = $rel;
                    break;
                }
            }
            if ($inR !== null) {
                $inC->emptyRelations();
                $inC->emptyResourceRelations();
                array_push($results, array("constellation" => $inC, "relation" => $inR));
            }
        }
        usort($results,
                function ($a, $b) {
                    return $a['constellation']->getPreferredNameEntry()->getOriginal() <=> $b['constellation']->getPreferredNameEntry()->getOriginal();
                });
        return $results;
    }
public function listConstellationInEdges ( & $ constellation ) { $ results = array ( ) ; if ( $ constellation === null ) { return $ results ; } $ edgeList = $ this -> sql -> selectUnversionedConstellationIDsForRelationTarget ( $ constellation -> getID ( ) ) ; foreach ( $ edgeList as $ inEdge ) { $ inC = $ this -> readPublishedConstellationByID ( $ inEdge [ " ic_id " ] , DBUtil :: $ READ_MICRO_SUMMARY | DBUtil :: $ READ_RELATIONS ) ; $ inR = null ; foreach ( $ inC -> getRelations ( ) as $ rel ) { if ( $ rel -> getID ( ) == $ inEdge [ " id " ] && $ rel -> getTargetConstellation ( ) !== null && $ rel -> getTargetConstellation ( ) == $ constellation -> getID ( ) ) { $ inR = $ rel ; break ; } } if ( $ inR !== null ) { $ inC -> emptyRelations ( ) ; $ inC -> emptyResourceRelations ( ) ; array_push ( $ results , array ( " constellation " => $ inC , " relation " => $ inR ) ) ; } } usort ( $ results , function ( $ a , $ b ) { return $ a [ 'constellation' ] -> getPreferredNameEntry ( ) -> getOriginal ( ) <=> $ b [ 'constellation' ] -> getPreferredNameEntry ( ) -> getOriginal ( ) ; } ) ; return $ results ; }
List In Edges for Constellation
 Lists the Constellations with constellation relations pointing TO the given Constellation.
List In Edges for Constellation Lists the Constellations with constellation relations pointing TO the given Constellation .
// This constitutes some cheating:  We will ask for a list of [IC_ID,relation_id]s (regardless of version) that // point in to this constellation, then go through and check each one by hand to see if they // currently still point to this constellation.  This allows us to take advantage of the structure // of the database as well as its indices. // Sort the in edges by preferred name