Hi ... as sbeam said, transactions wouldn't help, it had to be good ol' locking. I was able to reproduce this error quite easily, so I'm not too sure about the one in a million thing.
I tweaked grigri ListBehavior class a bit to support locking. I first used table locks but because of the way Cake handles the updates you have to lock half the database to get the update done. So I used the GET_LOCK funtions you mentioned. What struck me funny is that GET_LOCK always returns 1, no matter if a lock exists or not. Perhaps I got the the documentation wrong or it has to do with the Windows box I'm on ... anyway, only IS_FREE_LOCK would properly recognise the lock. Also $model->query is a really dangerous thing to use. Since it caches stuff like SELECT IS_FREE_LOCK this query only gets executed the first time, took me a while to figure that out. Abusing $model->field (only a bit :) works way better. You'll find the behavior here http://bin.cakephp.org/view/1410543845 ... comments are very welcome wirtsi On 12 Feb., 19:09, sbeam <[EMAIL PROTECTED]> wrote: > thanks for the explanation on calling Behaviors... > > On Feb 12, 9:20 am, grigri <[EMAIL PROTECTED]> wrote: > > > This way, if controller "CategoriesController" works on model > > "Category", then the following links will work without any extra > > controller or model code whatsoever: > > > /admin/categories/move_up/{id} > > /admin/categories/move_down/{id} > > this is very cool. So this calls $CategoryController->admin_move_up(id) ... I > assume you use a route to map that, or is > > there some other magic going on? (not to change the subject) > > > [I even have a generic helper to make a mini-toolbar with view, edit, > > delete and move options for a given model, so in most cases I just go > > echo $tool->bar($id) for each record, and it works transparently. I'm > > in to writing as little code as possible to get the job done.] > > Nice! I will have to try that at some pint. > > cheers --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
