src/snac/server/ServerExecutor.php
/**
     * Read Resource
     *
     * Given a resource id in the input, returns the resource object in the
     * response to the user.  If there is an error, it will add that.
     *
     * @param string[] $input Input array from the Server object
     * @throws \snac\exceptions\SNACInputException
     * @return string[] The response to send to the client
     */
Read Resource
Given a resource id in the input, returns the resource object in the
response to the user.  If there is an error, it will add that.

@param string[] $input Input array from the Server object
@throws \snac\exceptions\SNACInputException
@return string[] The response to send to the client
Read Resource Given a resource id in the input returns the resource object in the response to the user . If there is an error it will add that . @param string [] $input Input array from the Server object @throws \ snac \ exceptions \ SNACInputException @return string [] The response to send to the client
public function readResource(&$input) {
        $response = [];
        $resource = null;
        try {
            if (!isset($input["resourceid"])) {
                throw new \snac\exceptions\SNACInputException("No resource to read", 400);
            }
            $id = $input["resourceid"];
            $version = null;
            if (isset($input["version"]))
                $version = $input["version"];
            $resource = $this->cStore->readResource($id, $version);
            if (isset($resource))
                $response["resource"] = $resource->toArray();
            $response["related_constellations"] = [];
            if (isset($input["relationships"])) {
                $icids = $this->neo4J->getResourcesRelatedConstellationIDs($input["resourceid"]);
                foreach ($icids as $icid) {
                    $constellation = $this->cStore->readPublishedConstellationByID($icid, \snac\server\database\DBUtil::$READ_SHORT_SUMMARY);
                    if (isset($constellation) && $constellation != false) {
                        $response["related_constellations"][] = $constellation->toArray();
                    }
                }
            }
            $this->logger->addDebug("Serialized resource for output to client", $response);
        } catch (Exception $e) {
            $response["error"] = $e;
        }
        return $response;
    }
public function readResource ( & $ input ) { $ response = [ ] ; $ resource = null ; try { if ( ! isset ( $ input [ " resourceid " ] ) ) { throw new \ snac \ exceptions \ SNACInputException ( " No resource to read " , 400 ) ; } $ id = $ input [ " resourceid " ] ; $ version = null ; if ( isset ( $ input [ " version " ] ) ) $ version = $ input [ " version " ] ; $ resource = $ this -> cStore -> readResource ( $ id , $ version ) ; if ( isset ( $ resource ) ) $ response [ " resource " ] = $ resource -> toArray ( ) ; $ response [ " related_constellations " ] = [ ] ; if ( isset ( $ input [ " relationships " ] ) ) { $ icids = $ this -> neo4J -> getResourcesRelatedConstellationIDs ( $ input [ " resourceid " ] ) ; foreach ( $ icids as $ icid ) { $ constellation = $ this -> cStore -> readPublishedConstellationByID ( $ icid , \ snac \ server \ database \ DBUtil :: $ READ_SHORT_SUMMARY ) ; if ( isset ( $ constellation ) && $ constellation != false ) { $ response [ " related_constellations " ] [ ] = $ constellation -> toArray ( ) ; } } } $ this -> logger -> addDebug ( " Serialized resource for output to client " , $ response ) ; } catch ( Exception $ e ) { $ response [ " error " ] = $ e ; } return $ response ; }
Read Resource
 Given a resource id in the input, returns the resource object in the
 response to the user.
Read Resource Given a resource id in the input returns the resource object in the response to the user .