j4mie/idiorm — pull request #72 by hellogerard (2012-11-15 16:27:36+00:00)
Title: Fix bug where input parameters were sent as part-indexed, part associati...

...ve array

Hello,

Thanks for taking over the project. I updated idiorm with great anticipation and ran into an error on a simple update. Taking the example from the test, the following code:

$widget = ORM::for_table('widget')->find_one(1);
$widget->name = "Fred";
$widget->age = 10;
$widget->save();

passes the test because it is not actually executed. Upon execution, I get the following error:

SQLSTATE[HY093]: Invalid parameter number: parameter was not defined

If I dump out the input parameters sent to `execute()` (line 1285), I get:

array(3) {
'name' => string(4) "Fred"
'age' => int(10)
[0] => string(1) "1"
}

PDO does not seem to like the mix of named and indexed parameters. This PR fixes this so that the input parameters are all indexed array values.

Gerard

(I had to re-submit this because I accidentally deleted my branch.)