[osflash] [announcement] CakeAMFPHP 0.6.0 released
Martin Wood-Mitrovski
flashdev at relivethefuture.com
Mon Oct 23 12:25:50 EDT 2006
Marco Madarco wrote:
> Really good job guys! AMF + cake Model&Scaffolding is a dream.
> I've only a question:
> I started using cakeAMFPHP 0.6 (& cake 1.1.8.3544) some days ago and
> I'm having problem returning query results. After poking around the code
> for a while, it seems that CakeMySqlAdapter.php return only the results
> from last query, so it doesn't work if the model has some $has*
> relationships. I'm missing something?
> For now I've solved the problem returning an Arrayf.
No, youre not missing anything.
If you return a recordset then you wont get the right results if you are using
associative models and/or setting $model->recursive.
This is because the cake code performs a number of sql queries for one model
method and then does an array_merge with the results. So when you follow the
recordset technique of getting the response from the DBConnection it just
returns the results of the last query in the set, which is often empty. As you
found out using Arrayf is the best way to go.
This is one of the reasons I avoid returning recordsets from CakeAMFPHP, the
other is because the DBConnection stuff makes the code specific to the remoting
interface. Just returning the cake array structures allows you to keep the same
code for both html and remoting sections.
martin.
More information about the osflash
mailing list