laravel/framework — pull request #3099 by anlutro (2014-01-01 20:57:11+00:00)
Title: Separate query bindings

This is a new implementation of #884.

Currently it's near impossible to add a sub select, having or order by clause to a query builder as long as it has a binding - the order of the query binding gets completely messed up because all bindings are put into a single flat array. Therefore I propose this change which separates the bindings into 4 different categories.

It seems to pass all unit tests. The default `$type` value of 'where' on the various binding manipulation methods and the new `getBindings` method should ensure decent backwards compatibility. I had to modify one unrelated one, but it didn't make much sense to begin with - expecting the bindings to be `array('foo' => 'bar')` is stupid when we're using unnamed parameters (`?` as opposed to `:foo`). Nevertheless this is a pretty big change so I thought it best to target the master branch.

As an extension of this I would love to implement a selectSub and/or selectRaw method.