简体   繁体   English

如何从arangodb-php调用ArangoDB Foxx应用程序

[英]How to call ArangoDB Foxx applications from arangodb-php

With ArangoDB-PHP I can easily run AQL querys, but is it possible to use (means "execute") Foxx applications (ie 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? 使用ArangoDB-PHP,我可以轻松地运行AQL查询,但是可以使用(表示“执行”)Foxx应用程序(即,当我从https://github.com/arangodb-foxx/安装foxx / util-sessions-local时) util-sessions-local )-如何使用ArangoDB-PHP创建/更新/删除会话服务? Could it be achieved by running AQL or user javascript functions? 是否可以通过运行AQL或用户JavaScript函数来实现?

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. 看一看ArangoDB-PHP的Transaction类似乎不是正确的解决方案,因为它需要读写集合名称...对于更复杂的Foxx应用程序我无法提供。

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. 据我所知,您不能从AQL事务内部调用foxx端点-旨在在foxx端点代码中使用AQL事务。 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 . 因此,如果您需要执行事务性事务,则可能需要提供其他端点,这些端点可以在事务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): 要回答帖子标题的问题,有一种简单的方法可以调用foxx端点,仅提供arangodb-php(假设应用程序返回json-data):

// $connection is your triagens\Arangodb\Connection instance
//       ArangodbClient\Connection in newer versions
$connection->post("/mountpoint/endpoint", $json_body, $headers)->getJson();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM