{"action":"created","issue":{"url":"https://api.github.com/repos/Ostico/PhpOrient/issues/16","repository_url":"https://api.github.com/repos/Ostico/PhpOrient","labels_url":"https://api.github.com/repos/Ostico/PhpOrient/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/Ostico/PhpOrient/issues/16/comments","events_url":"https://api.github.com/repos/Ostico/PhpOrient/issues/16/events","html_url":"https://github.com/Ostico/PhpOrient/issues/16","id":64462099,"number":16,"title":"Support for executing a function","user":{"login":"andreyvk","id":1415506,"avatar_url":"https://avatars.githubusercontent.com/u/1415506?v=3","gravatar_id":"","url":"https://api.github.com/users/andreyvk","html_url":"https://github.com/andreyvk","followers_url":"https://api.github.com/users/andreyvk/followers","following_url":"https://api.github.com/users/andreyvk/following{/other_user}","gists_url":"https://api.github.com/users/andreyvk/gists{/gist_id}","starred_url":"https://api.github.com/users/andreyvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreyvk/subscriptions","organizations_url":"https://api.github.com/users/andreyvk/orgs","repos_url":"https://api.github.com/users/andreyvk/repos","events_url":"https://api.github.com/users/andreyvk/events{/privacy}","received_events_url":"https://api.github.com/users/andreyvk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-03-26T07:52:38Z","updated_at":"2016-04-15T02:52:04Z","closed_at":null,"body":"Hi,\r\n\r\nIs there any milestone for supporting executing functions? For instance:\r\n\r\n```php\r\n$client = new PhpOrient(...);\r\n$client->configure(...);\r\n$client->functionExec('functionName', ['function', 'args']);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Ostico/PhpOrient/issues/comments/210261128","html_url":"https://github.com/Ostico/PhpOrient/issues/16#issuecomment-210261128","issue_url":"https://api.github.com/repos/Ostico/PhpOrient/issues/16","id":210261128,"user":{"login":"andreyvk","id":1415506,"avatar_url":"https://avatars.githubusercontent.com/u/1415506?v=3","gravatar_id":"","url":"https://api.github.com/users/andreyvk","html_url":"https://github.com/andreyvk","followers_url":"https://api.github.com/users/andreyvk/followers","following_url":"https://api.github.com/users/andreyvk/following{/other_user}","gists_url":"https://api.github.com/users/andreyvk/gists{/gist_id}","starred_url":"https://api.github.com/users/andreyvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreyvk/subscriptions","organizations_url":"https://api.github.com/users/andreyvk/orgs","repos_url":"https://api.github.com/users/andreyvk/repos","events_url":"https://api.github.com/users/andreyvk/events{/privacy}","received_events_url":"https://api.github.com/users/andreyvk/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T02:52:04Z","updated_at":"2016-04-15T02:52:04Z","body":"@smolinari i sort of figured it out. actually, we can just return JSON from the function. the solution is as follows:\r\n\r\n```\r\nvar g=orient.getGraph();\r\nvar gres=g.command(\"sql\",\"select @this.toJSON() as json from MyClass limit 3\");\r\n\r\nvar res = [];\r\nfor(var i in gres) {\r\n \tres.push(gres[i].getProperty(\"json\"));\r\n}\r\n\r\nreturn res;\r\n```\r\n\r\nFunctions are primarily used to do some routine stuff and normally should not return much. so returning JSON should be more than enough for the time being\r\n\r\n"}}