Paradox/toolbox/Query.php
public function getOne($query, array $parameters = array())
    {
        if ($this->_toolbox->getTransactionManager()->hasTransaction()) {

            $statement = json_encode(array('query' => $query, 'bindVars' => $parameters), JSON_FORCE_OBJECT);
            $this->_toolbox->getTransactionManager()->addCommand("function () {var elements = db._createStatement($statement).execute().elements(); return elements[0] ? elements[0] : null}();" , "Query:getOne");

        } else {
            $data = array(
                    'query' => $query,
                    'bindVars' => $parameters,
                    Cursor::ENTRY_FLAT => true
            );

            $statement = new Statement($this->_toolbox->getConnection(), $data);

            try {
                $cursor = $statement->execute();
            } catch (\Exception $e) {
                $normalised = $this->_toolbox->normaliseDriverExceptions($e);
                throw new QueryException($normalised['message'], $normalised['code']);
            }

            if ($cursor->valid()) {
                $cursor->rewind();

                return $cursor->current();
            } else {
                return null;
            }
        }
    }
public function getOne($query, array $parameters = array())
    {
        if ($this->_toolbox->getTransactionManager()->hasTransaction()) {

            $statement = json_encode(array('query' => $query, 'bindVars' => $parameters), JSON_FORCE_OBJECT);
            $this->_toolbox->getTransactionManager()->addCommand("function () {var elements = db._createStatement($statement).execute().elements(); return elements[0] ? elements[0] : null}();" , "Query:getOne");

        } else {
            $data = array(
                    'query' => $query,
                    'bindVars' => $parameters,
                    Cursor::ENTRY_FLAT => true
            );

            $statement = new Statement($this->_toolbox->getConnection(), $data);

            try {
                $cursor = $statement->execute();
            } catch (\Exception $e) {
                $normalised = $this->_toolbox->normaliseDriverExceptions($e);
                throw new QueryException($normalised['message'], $normalised['code']);
            }

            if ($cursor->valid()) {
                $cursor->rewind();

                return $cursor->current();
            } else {
                return null;
            }
        }
    }
Executes an AQL query and return the first result. If nothing is found, null is returned.
@param  string         $query      The AQL query to run.
@param  array          $parameters An optional associative array containing parameters to bind to the query.
@throws QueryException
@return return         AModel