danielmewes / php-rql

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

Rdb multiple args #140

Open Geekimo opened 8 years ago

Geekimo commented 8 years ago

Adding php-rql multiple (>2) arguments support for the following API functions:

Plus a few enhancements for PSR-2 support.

danielmewes commented 8 years ago

Cool, thanks for the pull request @Geekimo . I'll see to get this into the next version.

A bit of background: So far I've restrained from introducing variadic functions into PHP-ReQL, for the reason that it creates ambiguities whenever a ReQL term accepts optional arguments. Since optional (named) arguments in PHP-ReQL are just passed in as an object, we have to be able to distinguish whether a given argument is a set of options, or just an object that should be converted to a ReQL datum. If all functions have a fixed number of arguments, this is easy, since the optional argument object has a fixed position too (always the last argument). With variadic functions this no longer works, and things get hacky and potentially ambiguous.

For the particular cases of rOr, rAnd and contains, I think this is reasonable though. None of these take optional arguments, and I don't expect them to start taking optional arguments in a future version of ReQL. So again, thanks for working on this.