webCOMAND

comand::repo()

The easiest method to connect to a repository.  It returns a repository connection based on API defaults, server configuration files, and options passed to this method.

For less commonly needed connection and discovery features, like creating multiple repository connections, see Constructor and connect().

Prototype

repo comand::repo(array $options = [], bool $force = FALSE)

Parameters

  • options - Optional associative array of repository connection options.  See connect method $options for valid values.
  • force - Optional bool (default is FALSE).  If TRUE, a new repository connection will be created, even if connecting to the same endpoint.
Repository objects have internal memory management to prevent the object cache from consuming all PHP memory.  However, sometimes it may be necessary to release a repository object and reconnect to clean up all internal memory.  Call repo::uninit() to release a repository before overwriting the repository object variable.

Return

A repo object is returned, which can be used to access and query the repository.

Example

require_once('path/to/comand.php');

$repo = \comand::repo();
$contact = $repo->get_first("FROM Contact WHERE Name='John' LIMIT 1");
echo($contact . "\n");

Related

connect(), uninit()