class HttpBinding implements HttpBindingInterface (View source)

Properties

protected $server
protected $database
protected $adapter

Methods

__construct(BindingParameters $parameters, HttpClientAdapterInterface $adapter = null)

Instantiates a new binding.

string
getLocation(string $method, string $database = null, array $arguments = null)

Creates a relative URL for the specified OrientDB method call.

string
getQueryLocation($database, $query, $limit = null, $fetchPlan = null, $language = BindingInterface::LANGUAGE_SQLPLUS)

Returns the URL for the execution of a query.

string
getDocumentLocation(string $database, string $rid = null, string $fetchPlan = null)

Returns the URL to fetch a document.

string
getClassLocation(string $database, string $class)

Returns the URL to fetch a class.

string
getClusterLocation(string $database, string $cluster, int $limit = null)

Returns the URL to fetch a cluster.

string
getDatabaseLocation(string $database)

Returns the URL to fetch a database.

deleteClass(string $class, string $database = null)

Deletes a class.

getClass(string $class, string $database = null)

Retrieves a class and its records.

postClass(string $class, string $body = null, string $database = null)

Creates a new class.

cluster($cluster, $limit = null, $database = null)

Retrieves records from the given cluster in the database.

connect(string $database)

Connects to the specified database.

disconnect()

Disconnect this instance from the server.

getServer()

Gets the current server.

getDatabase(string $database = null)

Retrieves details regarding the specified database.

createDatabase(string $database, string $storage = 'memory', string $type = 'document')

Creates a new database.

listDatabases()

Lists all the existing databases.

deleteDatabase(string $database)

Deletes an existing database.

execute(Query $query, $fetchPlan = null)

Executes an SQL query on the server.

command(string $query, string $language = BindingInterface::LANGUAGE_SQLPLUS, string $database = null)

Executes a raw command on the given database.

query(string $query, int $limit = null, string $fetchPlan = null, string $language = BindingInterface::LANGUAGE_SQLPLUS, string $database = null)

Executes a raw query on the given database.

getDocument(string $rid, string $database = null, string $fetchPlan = null)

Retrieves a record from the database. An optional fetch plan can be used to specify how to retrieve the graph and limit its depth.

postDocument(string $document, string $database = null)

Stores a new document in the database.

putDocument(string $rid, string $document, string $database = null)

Updates an existing document in the database.

deleteDocument(string $rid, string $version = null, string $database = null)

Deletes a document from the database.

setDatabase(string $database)

Sets the default database for the current binding instance.

string
getDatabaseName()

Returns the name of the current database in use.

ensureDatabase($database)

Checks wheter the specified database string is valid to perform a request.

setAuthentication(string $username = null, string $password = null)

Sets the username and password used to authenticate to the server.

setAdapter(HttpClientAdapterInterface $adapter)

Sets the underlying HTTP client adapter.

getAdapter()

Sets the underlying HTTP client adapter.

Details

__construct(BindingParameters $parameters, HttpClientAdapterInterface $adapter = null)

Instantiates a new binding.

Parameters

BindingParameters $parameters
HttpClientAdapterInterface $adapter

protected string getLocation(string $method, string $database = null, array $arguments = null)

Creates a relative URL for the specified OrientDB method call.

Parameters

string $method
string $database
array $arguments

Return Value

string

protected string getQueryLocation($database, $query, $limit = null, $fetchPlan = null, $language = BindingInterface::LANGUAGE_SQLPLUS)

Returns the URL for the execution of a query.

Parameters

$database
$query
$limit
$fetchPlan
$language

Return Value

string

protected string getDocumentLocation(string $database, string $rid = null, string $fetchPlan = null)

Returns the URL to fetch a document.

Parameters

string $database
string $rid
string $fetchPlan

Return Value

string

protected string getClassLocation(string $database, string $class)

Returns the URL to fetch a class.

Parameters

string $database
string $class

Return Value

string

protected string getClusterLocation(string $database, string $cluster, int $limit = null)

Returns the URL to fetch a cluster.

Parameters

string $database
string $cluster
int $limit

Return Value

string

protected string getDatabaseLocation(string $database)

Returns the URL to fetch a database.

Parameters

string $database

Return Value

string

BindingResultInterface deleteClass(string $class, string $database = null)

Deletes a class.

Parameters

string $class
string $database

Return Value

BindingResultInterface

BindingResultInterface getClass(string $class, string $database = null)

Retrieves a class and its records.

Parameters

string $class
string $database

Return Value

BindingResultInterface

BindingResultInterface postClass(string $class, string $body = null, string $database = null)

Creates a new class.

Parameters

string $class
string $body
string $database

Return Value

BindingResultInterface

BindingResultInterface cluster($cluster, $limit = null, $database = null)

Retrieves records from the given cluster in the database.

Parameters

$cluster
$limit
$database

Return Value

BindingResultInterface

BindingResultInterface connect(string $database)

Connects to the specified database.

Parameters

string $database

Return Value

BindingResultInterface

BindingResultInterface disconnect()

Disconnect this instance from the server.

Return Value

BindingResultInterface

BindingResultInterface getServer()

Gets the current server.

Return Value

BindingResultInterface

BindingResultInterface getDatabase(string $database = null)

Retrieves details regarding the specified database.

Parameters

string $database

Return Value

BindingResultInterface

BindingResultInterface createDatabase(string $database, string $storage = 'memory', string $type = 'document')

Creates a new database.

Parameters

string $database
string $storage
string $type

Return Value

BindingResultInterface

BindingResultInterface listDatabases()

Lists all the existing databases.

Return Value

BindingResultInterface

BindingResultInterface deleteDatabase(string $database)

Deletes an existing database.

Parameters

string $database

Return Value

BindingResultInterface

BindingResultInterface execute(Query $query, $fetchPlan = null)

Executes an SQL query on the server.

The second argument specifies when to use COMMAND or QUERY as the underlying command.

Parameters

Query $query
$fetchPlan

Return Value

BindingResultInterface

BindingResultInterface command(string $query, string $language = BindingInterface::LANGUAGE_SQLPLUS, string $database = null)

Executes a raw command on the given database.

Parameters

string $query
string $language
string $database

Return Value

BindingResultInterface

BindingResultInterface query(string $query, int $limit = null, string $fetchPlan = null, string $language = BindingInterface::LANGUAGE_SQLPLUS, string $database = null)

Executes a raw query on the given database.

Results can be limited with the $limit parameter and a fetch plan can be used to specify how to retrieve the graph and limit its depth.

It differs from the command because OrientDB defines a query as a SELECT only.

Parameters

string $query SQL or Gremlin query.
int $limit Maximum number of records (default is 20).
string $fetchPlan
string $language
string $database

Return Value

BindingResultInterface

BindingResultInterface getDocument(string $rid, string $database = null, string $fetchPlan = null)

Retrieves a record from the database. An optional fetch plan can be used to specify how to retrieve the graph and limit its depth.

Parameters

string $rid
string $database
string $fetchPlan

Return Value

BindingResultInterface

BindingResultInterface postDocument(string $document, string $database = null)

Stores a new document in the database.

Parameters

string $document
string $database

Return Value

BindingResultInterface

BindingResultInterface putDocument(string $rid, string $document, string $database = null)

Updates an existing document in the database.

Parameters

string $rid
string $document
string $database

Return Value

BindingResultInterface

BindingResultInterface deleteDocument(string $rid, string $version = null, string $database = null)

Deletes a document from the database.

Parameters

string $rid
string $version
string $database

Return Value

BindingResultInterface

setDatabase(string $database)

Sets the default database for the current binding instance.

Parameters

string $database

string getDatabaseName()

Returns the name of the current database in use.

Return Value

string

protected ensureDatabase($database)

Checks wheter the specified database string is valid to perform a request.

Parameters

$database

Exceptions

Exception

setAuthentication(string $username = null, string $password = null)

Sets the username and password used to authenticate to the server.

Parameters

string $username
string $password

setAdapter(HttpClientAdapterInterface $adapter)

Sets the underlying HTTP client adapter.

Parameters

HttpClientAdapterInterface $adapter

HttpClientAdapterInterface getAdapter()

Sets the underlying HTTP client adapter.