Provides management of user-functions
AqlUserFunction object
An AqlUserFunction is an object that is used to manage AQL User Functions.
It registers, un-registers and lists user functions on the server
The object encapsulates:
The object requires the connection object and can be initialized
with or without initial configuration.
Any configuration can be set and retrieved by the object's methods like this:
$this->setName('myFunctions:myFunction');
$this->setCode('function (){your code};');
or like this:
$this->name('myFunctions:myFunction');
$this->code('function (){your code};');
| package | ArangoDBClient |
|---|---|
| since | 1.3 |
__construct(\ArangoDBClient\Connection $connection, array $attributesArray = null)
The $attributesArray array can be used to specify the name and code for the user function in form of an array.
Example: array( 'name' => 'myFunctions:myFunction', 'code' => 'function (){}' )
\ArangoDBClient\Connectionarray\ArangoDBClient\ClientException |
|---|
__get(string $key) : mixed
This function is mapped to get() internally.
| magic |
|---|
stringmixed- value of attribute, NULL if attribute is not set__isset(string $key) : boolean
stringbooleanreturns true or false (set or not set)__set(string $key, mixed $value)
This is a magic method that allows the object to be used without declaring all attributes first.
| magic |
|---|
stringmixed\ArangoDBClient\ClientException |
|---|
buildAttributesFromArray($options)
\ArangoDBClient\ClientException |
|---|
get(string $key) : mixed
stringmixed- value of attribute, NULL if attribute is not setgetCode() : string
stringnamegetName() : string
stringnamegetRegisteredUserFunctions(null $namespace = null) : mixed
The method can optionally be passed a $namespace parameter to narrow the results down to a specific namespace.
null
\ArangoDBClient\Exception |
throw exception if the request failed |
|---|
mixedtrue if successful without a return value or the return value if one was set in the actionregister(null $name= null, null $code= null) : mixed
If no parameters ($name,$code) are passed, it will use the properties of the object.
If $name and/or $code are passed, it will override the object's properties with the passed ones
null
null
\ArangoDBClient\Exception |
throws exception if registration failed |
|---|
mixedtrue if registration was successful.set($key, $value) : \ArangoDBClient\AqlUserFunction
| fluent | This method is part of a fluent interface and will return the same instance |
|---|
\ArangoDBClient\ClientException |
|---|
\ArangoDBClient\AqlUserFunctionsetCode(string $value)
string
\ArangoDBClient\ClientException |
|---|
setName(string $value)
correct: 'myNamespace:myFunction' 'myRootNamespace:mySubNamespace:myFunction'
wrong: 'myFunction'
string
\ArangoDBClient\ClientException |
|---|
unregister(string $name= null, boolean $namespace= false) : mixed
If no parameter ($name) is passed, it will use the property of the object.
If $name is passed, it will override the object's property with the passed one
string
boolean
\ArangoDBClient\Exception |
throw exception if the request fails |
|---|
mixedtrue if successful without a return value or the return value if one was set in the actiongetConnection() : \ArangoDBClient\Connection
\ArangoDBClient\Connection- the connection object$code : string
| magic | |
|---|---|
| property | - The code of the user function |
$name : string
| magic | |
|---|---|
| property | - The name of the user function |
$attributes : array
array()$_connection : \ArangoDBClient\Connection
ENTRY_CODE = 'code'
ENTRY_NAME = 'name'