I'm just getting familiar with cakephp (thanks to the developer before me), and ran into something funny. I have finally found out what went wrong, but still do not know why. In very pseudo code:
a controller function calls bar() twice in the same scope:
$value = 'A';
$this->foo->bar($value);
// do other stuff
$value = 'B';
$this->foo->bar($value);
bar() basically just calls cakephp's save() model to write $value to table foobar$:
$AppModel->save(array(
'AppModel'=> array('value'=>$value)
));
I expected that save() would create two rows in foobar$, however this was not the case. It first created a row with value A, then updated that row to value B. When the second call ran, it recognized the DB id generated by the previous call, decided it was the same entry and made it an update instead of insert. It sort of makes sense, but they still are separate calls, right? What obvious thing am I missing here? Thanks a lot.