webCOMAND

repo::__construct()

The repository constructor is not intended to be called directly. A repository should be created from comand::connect().

When a repository is created by the comand connect method, the comand object will manage and maintain the repository connection. When created directly with the constructor, the creator is responsible for managing the connection. For example, if multiple connections to the same repository are made with the connect method, the same repository will be reused. Created from the constructor, multiple repository objects will be created and incur significant additional overhead.

Prototype

repo repo(comand $comand, array $options = [])

Parameters

  • $comand - The comand instance to associate with this repository connection.
  • $options (optional) - See comand::connect() options.
require_once( 'comand.php' );

// recommended way to access a repository
$comand = new comand();
$repo = $comand->connect( array( 'url' => 'comand://localhost' ) );

// discourated alternative
$repo = new \io_comand_repo\repo( array( 'url' => 'comand://localhost' ) );