Location: PHPKode > projects > ArangoDB-PHP > ArangoDB-PHP-1.3.0/docs/classes/triagens.ArangoDb.AqlUserFunction.html
<!DOCTYPE html><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>ArangoDB PHP client API » \triagens\ArangoDb\AqlUserFunction</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script><script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script><script src="../js/jquery.mousewheel.min.js" type="text/javascript"></script><script src="../js/bootstrap.js" type="text/javascript"></script><script src="../js/template.js" type="text/javascript"></script><script src="../js/prettify/prettify.min.js" type="text/javascript"></script><link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner"><div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a class="brand" href="../index.html">ArangoDB PHP client API</a><div class="nav-collapse"><ul class="nav">
<li class="dropdown">
<a href="#api" class="dropdown-toggle" data-toggle="dropdown">
                                    API Documentation <b class="caret"></b></a><ul class="dropdown-menu">
<li><a>Namespaces</a></li>
<li><a href="../namespaces/triagens.html"><i class="icon-th"></i> triagens</a></li>
<li><a>Packages</a></li>
<li><a href="../packages/triagens.html"><i class="icon-folder-open"></i> triagens</a></li>
</ul>
</li>
<li class="dropdown" id="charts-menu">
<a href="#charts" class="dropdown-toggle" data-toggle="dropdown">
                                    Charts <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="../graph_class.html"><i class="icon-list-alt"></i> Class hierarchy diagram</a></li></ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#reports" class="dropdown-toggle" data-toggle="dropdown">
                                    Reports <b class="caret"></b></a><ul class="dropdown-menu">
<li><a href="../errors.html"><i class="icon-remove-sign"></i> Errors 
                <span class="label label-info">0</span></a></li>
<li><a href="../markers.html"><i class="icon-map-marker"></i> Markers 
                <ul></ul></a></li>
<li><a href="../deprecated.html"><i class="icon-stop"></i> Deprecated elements 
                <span class="label label-info">9</span></a></li>
</ul>
</li>
</ul></div>
</div></div>
<div class="go_to_top"><a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a></div>
</div>
<div id="___" class="container">
<noscript><div class="alert alert-warning">
                            Javascript is disabled; several features are only available
                            if Javascript is enabled.
                        </div></noscript>
<div class="row">
<div class="span4">
<span class="btn-group visibility" data-toggle="buttons-checkbox"><button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button></span><div class="btn-group view pull-right" data-toggle="buttons-radio">
<button class="btn details" title="Show descriptions and method names"><i class="icon-list"></i></button><button class="btn simple" title="Show only method names"><i class="icon-align-justify"></i></button>
</div>
<ul class="side-nav nav nav-list">
<li class="nav-header">
<i class="icon-custom icon-method"></i> Methods
                    <ul>
<li class="method public "><a href="#method___construct" title="__construct :: Initialise the AqlUserFunction object"><span class="description">Initialise the AqlUserFunction object</span><pre>__construct()</pre></a></li>
<li class="method public "><a href="#method___get" title="__get :: Get an attribute, magic method"><span class="description">Get an attribute, magic method</span><pre>__get()</pre></a></li>
<li class="method public "><a href="#method___set" title="__set :: Set an attribute, magic method"><span class="description">Set an attribute, magic method</span><pre>__set()</pre></a></li>
<li class="method public "><a href="#method___toString" title="__toString :: Returns the action string"><span class="description">Returns the action string</span><pre>__toString()</pre></a></li>
<li class="method public "><a href="#method_buildAttributesFromArray" title="buildAttributesFromArray :: Build the object's attributes from a given array"><span class="description">Build the object's attributes from a given array</span><pre>buildAttributesFromArray()</pre></a></li>
<li class="method public "><a href="#method_get" title="get :: Get an attribute"><span class="description">Get an attribute</span><pre>get()</pre></a></li>
<li class="method public "><a href="#method_getCode" title="getCode :: Get user function code"><span class="description">Get user function code</span><pre>getCode()</pre></a></li>
<li class="method public "><a href="#method_getName" title="getName :: Get name value"><span class="description">Get name value</span><pre>getName()</pre></a></li>
<li class="method public "><a href="#method_getRegisteredUserFunctions" title="getRegisteredUserFunctions :: Get registered user functions"><span class="description">Get registered user functions</span><pre>getRegisteredUserFunctions()</pre></a></li>
<li class="method public "><a href="#method_register" title="register :: Registers the user function"><span class="description">Registers the user function</span><pre>register()</pre></a></li>
<li class="method public "><a href="#method_set" title="set :: Set an attribute"><span class="description">Set an attribute</span><pre>set()</pre></a></li>
<li class="method public "><a href="#method_setCode" title="setCode :: Set user function code"><span class="description">Set user function code</span><pre>setCode()</pre></a></li>
<li class="method public "><a href="#method_setName" title="setName :: Set name of the user function."><span class="description">Set name of the user function.</span><pre>setName()</pre></a></li>
<li class="method public "><a href="#method_unregister" title="unregister :: Unregister the user function"><span class="description">Unregister the user function</span><pre>unregister()</pre></a></li>
</ul>
</li>
<li class="nav-header protected">» Protected
                    <ul><li class="method protected "><a href="#method_getConnection" title="getConnection :: Return the connection object"><span class="description">Return the connection object</span><pre>getConnection()</pre></a></li></ul>
</li>
<li class="nav-header">
<i class="icon-custom icon-property"></i> Properties
                    <ul>
<li class="property public "><a href="#property_" title=" :: _action"><span class="description"></span><pre></pre></a></li>
<li class="property public "><a href="#property_code" title="$code :: - The code of the user function"><span class="description"></span><pre>$code</pre></a></li>
<li class="property public "><a href="#property_name" title="$name :: - The name of the user function"><span class="description"></span><pre>$name</pre></a></li>
</ul>
</li>
<li class="nav-header protected">» Protected
                    <ul>
<li class="property protected "><a href="#property__action" title="$_action :: The transaction's action."><span class="description"></span><pre>$_action</pre></a></li>
<li class="property protected "><a href="#property_attributes" title="$attributes :: The transaction's attributes."><span class="description"></span><pre>$attributes</pre></a></li>
</ul>
</li>
<li class="nav-header private">» Private
                    <ul><li class="property private "><a href="#property__connection" title="$_connection :: The connection object"><span class="description"></span><pre>$_connection</pre></a></li></ul>
</li>
<li class="nav-header">
<i class="icon-custom icon-constant"></i> Constants
                    <ul>
<li class="constant  "><a href="#constant_ENTRY_CODE" title="ENTRY_CODE :: Action index"><span class="description">Action index</span><pre>ENTRY_CODE</pre></a></li>
<li class="constant  "><a href="#constant_ENTRY_NAME" title="ENTRY_NAME :: Collections index"><span class="description">Collections index</span><pre>ENTRY_NAME</pre></a></li>
</ul>
</li>
</ul>
</div>
<div class="span8">
<a id="\triagens\ArangoDb\AqlUserFunction"></a><ul class="breadcrumb">
<li>
<a href="../index.html"><i class="icon-custom icon-class"></i></a><span class="divider">\</span>
</li>
<li><a href="../namespaces/triagens.html">triagens</a></li>
<li>
<span class="divider">\</span><a href="../namespaces/triagens.ArangoDb.html">ArangoDb</a>
</li>
<li class="active">
<span class="divider">\</span><a href="../classes/triagens.ArangoDb.AqlUserFunction.html">AqlUserFunction</a>
</li>
</ul>
<div class="element class">
<p class="short_description">Class AqlUserFunction</p>
<div class="details">
<div class="long_description"><p>AqlUserFunction object
An AqlUserFunction is an object that is used to manage AQL User Functions.
It registers, unregisters and lists user functions on the server</p>

<p>The object encapsulates:</p>

<ul>
<li>the name of the function</li>
<li>the actual javascript function</li>
</ul>

<p>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:</p>

<p>$this->setName('myFunctions:myFunction');
$this->setCode('function (){your code};');</p>

<p>or like this:</p>

<p>$this->name('myFunctions:myFunction');
$this->code('function (){your code};');</p></div>
<table class="table table-bordered"><tr>
<th>package</th>
<td><a href="../packages/triagens.ArangoDb.html">triagens\ArangoDb</a></td>
</tr></table>
<h3>
<i class="icon-custom icon-method"></i> Methods</h3>
<a id="method___construct"></a><div class="element clickable method public method___construct" data-toggle="collapse" data-target=".method___construct .collapse">
<h2>Initialise the AqlUserFunction object</h2>
<pre>__construct(\triagens\ArangoDb\Connection $connection, array $attributesArray) : <a href="../classes/triagens.ArangoDb.AqlUserFunction.html">\triagens\ArangoDb\AqlUserFunction</a></pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>The $attributesArray array can be used to specify the name and code for the user function in form of an array.</p>

<p>Example:
array(
  'name' => 'myFunctions:myFunction',
  'code' => 'function (){}'
)</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$connection</h4>
<code><a href="../classes/triagens.ArangoDb.Connection.html">\triagens\ArangoDb\Connection</a></code><ul>
<li>the connection to be used</li>
</ul>
</div>
<div class="subelement argument">
<h4>$attributesArray</h4>
<code>array</code><ul>
<li>user function initialization data</li>
</ul>
</div>
<h3>Returns</h3>
<div class="subelement response"><code><a href="../classes/triagens.ArangoDb.AqlUserFunction.html">\triagens\ArangoDb\AqlUserFunction</a></code></div>
</div></div>
</div>
<a id="method___get"></a><div class="element clickable method public method___get" data-toggle="collapse" data-target=".method___get .collapse">
<h2>Get an attribute, magic method</h2>
<pre>__get(string $key) : mixed</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>This function is mapped to get() internally.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$key</h4>
<code>string</code><ul>
<li>name of attribute</li>
</ul>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>mixed</code>- value of attribute, NULL if attribute is not set</div>
</div></div>
</div>
<a id="method___set"></a><div class="element clickable method public method___set" data-toggle="collapse" data-target=".method___set .collapse">
<h2>Set an attribute, magic method</h2>
<pre>__set(string $key, mixed $value) : void</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>This is a magic method that allows the object to be used without
declaring all attributes first.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$key</h4>
<code>string</code><ul>
<li>attribute name</li>
</ul>
</div>
<div class="subelement argument">
<h4>$value</h4>
<code>mixed</code><ul>
<li>value for attribute</li>
</ul>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code><a href="../classes/triagens.ArangoDb.ClientException.html">\triagens\ArangoDb\ClientException</a></code></th>
<td></td>
</tr></table>
</div></div>
</div>
<a id="method___toString"></a><div class="element clickable method public method___toString" data-toggle="collapse" data-target=".method___toString .collapse">
<h2>Returns the action string</h2>
<pre>__toString() : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>- the current action string</div>
</div></div>
</div>
<a id="method_buildAttributesFromArray"></a><div class="element clickable method public method_buildAttributesFromArray" data-toggle="collapse" data-target=".method_buildAttributesFromArray .collapse">
<h2>Build the object's attributes from a given array</h2>
<pre>buildAttributesFromArray($options) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument"><h4>$options</h4></div>
</div></div>
</div>
<a id="method_get"></a><div class="element clickable method public method_get" data-toggle="collapse" data-target=".method_get .collapse">
<h2>Get an attribute</h2>
<pre>get(string $key) : mixed</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$key</h4>
<code>string</code><ul>
<li>name of attribute</li>
</ul>
</div>
<h3>Returns</h3>
<div class="subelement response">
<code>mixed</code>- value of attribute, NULL if attribute is not set</div>
</div></div>
</div>
<a id="method_getCode"></a><div class="element clickable method public method_getCode" data-toggle="collapse" data-target=".method_getCode .collapse">
<h2>Get user function code</h2>
<pre>getCode() : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>name</div>
</div></div>
</div>
<a id="method_getName"></a><div class="element clickable method public method_getName" data-toggle="collapse" data-target=".method_getName .collapse">
<h2>Get name value</h2>
<pre>getName() : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>name</div>
</div></div>
</div>
<a id="method_getRegisteredUserFunctions"></a><div class="element clickable method public method_getRegisteredUserFunctions" data-toggle="collapse" data-target=".method_getRegisteredUserFunctions .collapse">
<h2>Get registered user functions</h2>
<pre>getRegisteredUserFunctions(null $namespace) : mixed</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>The method can optionally be passed a $namespace parameter to narrow the results down to a specific namespace.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$namespace</h4>
<code>null</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code><a href="../classes/triagens.ArangoDb.Exception.html">\triagens\ArangoDb\Exception</a></code></th>
<td>throw exception if the request failed</td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response">
<code>mixed</code>true if successful without a return value or the return value if one was set in the action</div>
</div></div>
</div>
<a id="method_register"></a><div class="element clickable method public method_register" data-toggle="collapse" data-target=".method_register .collapse">
<h2>Registers the user function</h2>
<pre>register(null $name, null $code) : mixed</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>If no parameters ($name,$code) are passed, it will use the properties of the object.</p>

<p>If $name and/or $code are passed, it will override the object's properties with the passed ones</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$name</h4>
<code>null</code>
</div>
<div class="subelement argument">
<h4>$code</h4>
<code>null</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code><a href="../classes/triagens.ArangoDb.Exception.html">\triagens\ArangoDb\Exception</a></code></th>
<td>throws exception if registration failed</td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response">
<code>mixed</code>true if registration was successful.</div>
</div></div>
</div>
<a id="method_set"></a><div class="element clickable method public method_set" data-toggle="collapse" data-target=".method_set .collapse">
<h2>Set an attribute</h2>
<pre>set($key, $value) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument"><h4>$key</h4></div>
<div class="subelement argument"><h4>$value</h4></div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code><a href="../classes/triagens.ArangoDb.ClientException.html">\triagens\ArangoDb\ClientException</a></code></th>
<td></td>
</tr></table>
</div></div>
</div>
<a id="method_setCode"></a><div class="element clickable method public method_setCode" data-toggle="collapse" data-target=".method_setCode .collapse">
<h2>Set user function code</h2>
<pre>setCode(string $value) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$value</h4>
<code>string</code>
</div>
</div></div>
</div>
<a id="method_setName"></a><div class="element clickable method public method_setName" data-toggle="collapse" data-target=".method_setName .collapse">
<h2>Set name of the user function.</h2>
<pre>setName(string $value) </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>It must have at least one namespace, but also can have sub-namespaces.
correct:
'myNamespace:myFunction'
'myRootNamespace:mySubNamespace:myFunction'</p>

<p>wrong:
'myFunction'</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$value</h4>
<code>string</code>
</div>
</div></div>
</div>
<a id="method_unregister"></a><div class="element clickable method public method_unregister" data-toggle="collapse" data-target=".method_unregister .collapse">
<h2>Unregister the user function</h2>
<pre>unregister(null $name) : mixed</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>If no parameter ($name) is passed, it will use the property of the object.</p>

<p>If $name is passed, it will override the object's property with the passed one</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$name</h4>
<code>null</code>
</div>
<h3>Exceptions</h3>
<table class="table table-bordered"><tr>
<th><code><a href="../classes/triagens.ArangoDb.Exception.html">\triagens\ArangoDb\Exception</a></code></th>
<td>throw exception if the request fails</td>
</tr></table>
<h3>Returns</h3>
<div class="subelement response">
<code>mixed</code>true if successful without a return value or the return value if one was set in the action</div>
</div></div>
</div>
<a id="method_getConnection"></a><div class="element clickable method protected method_getConnection" data-toggle="collapse" data-target=".method_getConnection .collapse">
<h2>Return the connection object</h2>
<pre>getConnection() : <a href="../classes/triagens.ArangoDb.Connection.html">\triagens\ArangoDb\Connection</a></pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code><a href="../classes/triagens.ArangoDb.Connection.html">\triagens\ArangoDb\Connection</a></code>- the connection object</div>
</div></div>
</div>
<h3>
<i class="icon-custom icon-property"></i> Properties</h3>
<a id="property_"> </a><div class="element clickable property public property_" data-toggle="collapse" data-target=".property_ .collapse">
<h2></h2>
<pre> : mixed</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>magic</th>
<td></td>
</tr>
<tr>
<th>property</th>
<td>_action</td>
</tr>
</table>
</div></div>
</div>
<a id="property_code"> </a><div class="element clickable property public property_code" data-toggle="collapse" data-target=".property_code .collapse">
<h2></h2>
<pre>$code : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>magic</th>
<td></td>
</tr>
<tr>
<th>property</th>
<td>- The code of the user function</td>
</tr>
</table>
</div></div>
</div>
<a id="property_name"> </a><div class="element clickable property public property_name" data-toggle="collapse" data-target=".property_name .collapse">
<h2></h2>
<pre>$name : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>magic</th>
<td></td>
</tr>
<tr>
<th>property</th>
<td>- The name of the user function</td>
</tr>
</table>
</div></div>
</div>
<a id="property__action"> </a><div class="element clickable property protected property__action" data-toggle="collapse" data-target=".property__action .collapse">
<h2></h2>
<pre>$_action : string</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property_attributes"> </a><div class="element clickable property protected property_attributes" data-toggle="collapse" data-target=".property_attributes .collapse">
<h2></h2>
<pre>$attributes : array</pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="property__connection"> </a><div class="element clickable property private property__connection" data-toggle="collapse" data-target=".property__connection .collapse">
<h2></h2>
<pre>$_connection : <a href="../classes/triagens.ArangoDb.Connection.html">\triagens\ArangoDb\Connection</a></pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<h3>
<i class="icon-custom icon-constant"></i> Constants</h3>
<a id="constant_ENTRY_CODE"> </a><div class="element clickable constant  constant_ENTRY_CODE" data-toggle="collapse" data-target=".constant_ENTRY_CODE .collapse">
<h2>Action index</h2>
<pre>ENTRY_CODE </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
<a id="constant_ENTRY_NAME"> </a><div class="element clickable constant  constant_ENTRY_NAME" data-toggle="collapse" data-target=".constant_ENTRY_NAME .collapse">
<h2>Collections index</h2>
<pre>ENTRY_NAME </pre>
<div class="labels"></div>
<div class="row collapse"><div class="detail-description"><div class="long_description"></div></div></div>
</div>
</div>
</div>
</div>
</div>
<div class="row"><footer class="span12">
            Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
            Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a12</a> and<br>
            generated on 2013-05-11T17:21:43+03:00.<br></footer></div>
</div>
</body>
</html>
Return current item: ArangoDB-PHP