danielmewes / php-rql

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

r\branch shouldn't use nativeToDatumOrFunction #122

Closed danielmewes closed 8 years ago

danielmewes commented 8 years ago

An example for a query that currently fails:

...->update(function($x) {
    return r\branch(r\expr(true), array("v" => $x), null);
  })

This is because the $x inside the r\branch gets wrapped into a function, which it shouldn't. I remember that there were some commands that required that behavior from nativeToDatumOrFunction, though I should re-check why it was necessary exactly.

That aside, branch as far as I know can never accept a function, so it should call nativeToDatum() and not nativeToDatumOrFunction. We should also audit other uses of nativeToDatumOrFunction.

(as another side-note, branch should also auto-convert its first argument, and furthermore we should support variadic branch)

danielmewes commented 8 years ago

Fixed in dev for PHP-RQL 2.3.0.