0

With ArangoDB-PHP I can easily run AQL querys, but is it possible to use (means "execute") Foxx applications (i.e. when I install foxx/util-sessions-local from https://github.com/arangodb-foxx/util-sessions-local) - how to use the create/update/delete session services by ArangoDB-PHP? Could it be achieved by running AQL or user javascript functions?

A look at ArangoDB-PHP's Transaction class seems to be not the correct solution because it requires read and write collections name ... which I can't provide for more complex Foxx applications.

hwde
  • 353
  • 2
  • 6
  • Foxx-apps are accessed via HTTP -- use a browser-class, or file_get_contents on hand-mangled URLs or somesuch. – Tom Regner Jan 24 '17 at 13:07
  • Hi Tom, thanks, I know I could build a Foxx service that could be called by browser like clients. I was thinking about some kind of "pre-compiled transactions" callable by AQL. – hwde Jan 26 '17 at 07:49

1 Answers1

1

To the best of my knowledge, you cannot call a foxx-endpoint from inside of an AQL-transaction -- intended is that you use AQL-transactions in your foxx-endpoint code. So if you need to execute stuff transactional you might need to provide additional endpoints that execute the code in question inside of a transactions action.

To answer the question of the title of your post, there is an easy way to call foxx endpoints with only arangodb-php available (assuming the application returns json-data):

// $connection is your triagens\Arangodb\Connection instance
//       ArangodbClient\Connection in newer versions
$connection->post("/mountpoint/endpoint", $json_body, $headers)->getJson();
Tom Regner
  • 6,856
  • 4
  • 32
  • 47