danielmewes / php-rql

A PHP client driver for the RethinkDB query language (ReQL).
http://php-rql.dnsalias.net/
339 stars 60 forks source link

RDo() Arguments Throw Error #153

Open bslayton opened 7 years ago

bslayton commented 7 years ago

I'm new to this library. Coming from the JS driver here. Am I doing this wrong, or is there a bug here. Can someone confirm?

I'm having an issue passing arguments to RDo().

r\expr(['first' => 'John'])
->RDo('Doe', function($first, $last){
    return $first->merge(['last'=>$last]);
})

This products the following exception.

Type: ReflectionException
Message: Function Doe() does not exist
Filename: /var/www/vendor/danielmewes/php-rql/rdb/DatumConverter.php
Line Number: 179
Backtrace:
File: /var/www/vendor/danielmewes/php-rql/rdb/DatumConverter.php
Line: 179
Function: __construct           
File: /var/www/vendor/danielmewes/php-rql/rdb/Queries/Control/RDo.php
Line: 12
Function: nativeToFunction          
File: /var/www/vendor/danielmewes/php-rql/rdb/ValuedQuery/ValuedQuery.php
Line: 418
Function: queryTest         
File: /var/www/test.php
Line: 101
Function: rDo           

Also, it doesn't work if I change the first argument of RDo to an array, either. And, it produces a slight different exception.

['Doe']
A PHP Error was encountered
Severity: Warning
Message:  ReflectionFunction::__construct() expects parameter 1 to be string, array given
Filename: rdb/DatumConverter.php
Line Number: 179
Backtrace:
File: /var/www/vendor/danielmewes/php-rql/rdb/DatumConverter.php
Line: 179
Function: __construct           
File: /var/www/vendor/danielmewes/php-rql/rdb/Queries/Control/RDo.php
Line: 12
Function: nativeToFunction          
File: /var/www/vendor/danielmewes/php-rql/rdb/ValuedQuery/ValuedQuery.php
Line: 418
Function: queryTest         
File: /var/www/application/test.php
Line: 101
Function: rDo

Thanks, Ben