src/snac/client/webui/WebUIExecutor.php
/**
     * Save Resource
     *
     * Maps the resource given on input to a Resource object, passes that to the server with an
     * update_resource or insert_resource call.
     *
     * @param string[] $input Post/Get inputs from the webui
     * @return string[] The web ui's response to the client (array ready for json_encode)
     */
Save Resource
Maps the resource given on input to a Resource object, passes that to the server with an
update_resource or insert_resource call.

@param string[] $input Post/Get inputs from the webui
@return string[] The web ui's response to the client (array ready for json_encode)
Save Resource Maps the resource given on input to a Resource object passes that to the server with an update_resource or insert_resource call . @param string [] $input Post / Get inputs from the webui @return string [] The web ui ' s response to the client ( array ready for json_encode )
public function saveResource(&$input) {
        $mapper = new \snac\client\webui\util\ResourcePostMapper();
        $resource = $mapper->serializeToResource($input);
        $this->logger->addDebug("writing resource", $resource->toArray());
        $command = $resource->getOperation() === "insert" ? "insert_resource" : "update_resource";
        $request = array("command" => $command);
        $request["resource"] = $resource->toArray();
        $serverResponse = $this->connect->query($request);
        $response = array();
        $response["server_debug"] = $serverResponse;
        if (!is_array($serverResponse)) {
            $this->logger->addDebug("server's response: $serverResponse");
        } else {
            if (isset($serverResponse["result"]))
                $response["result"] = $serverResponse["result"];
            if (isset($serverResponse["error"])) {
                $response["error"] = $serverResponse["error"];
            }
            if (isset($serverResponse["resource"])) {
                $this->logger->addDebug("server's response written resource", $serverResponse["resource"]);
                $resource = new \snac\data\Resource($serverResponse["resource"]);
                $response["resource"] = $resource->toArray();
            }
        }
        return $response;
    }
public function saveResource ( & $ input ) { $ mapper = new \ snac \ client \ webui \ util \ ResourcePostMapper ( ) ; $ resource = $ mapper -> serializeToResource ( $ input ) ; $ this -> logger -> addDebug ( " writing resource " , $ resource -> toArray ( ) ) ; $ command = $ resource -> getOperation ( ) === " insert " ? " insert_resource " : " update_resource " ; $ request = array ( " command " => $ command ) ; $ request [ " resource " ] = $ resource -> toArray ( ) ; $ serverResponse = $ this -> connect -> query ( $ request ) ; $ response = array ( ) ; $ response [ " server_debug " ] = $ serverResponse ; if ( ! is_array ( $ serverResponse ) ) { $ this -> logger -> addDebug ( " server's response:  $ serverResponse " ) ; } else { if ( isset ( $ serverResponse [ " result " ] ) ) $ response [ " result " ] = $ serverResponse [ " result " ] ; if ( isset ( $ serverResponse [ " error " ] ) ) { $ response [ " error " ] = $ serverResponse [ " error " ] ; } if ( isset ( $ serverResponse [ " resource " ] ) ) { $ this -> logger -> addDebug ( " server's response written resource " , $ serverResponse [ " resource " ] ) ; $ resource = new \ snac \ data \ Resource ( $ serverResponse [ " resource " ] ) ; $ response [ " resource " ] = $ resource -> toArray ( ) ; } } return $ response ; }
Save Resource
 Maps the resource given on input to a Resource object, passes that to the server with an
 update_resource or insert_resource call.
Save Resource Maps the resource given on input to a Resource object passes that to the server with an update_resource or insert_resource call .
// Get the resource object // Build a data structure to send to the server // Send the query to the server // Get the server's response constellation