Well... I was beginning to say that you didn't understand my problem... but after some minutes I realized that maybe I've just not understood how Cake works on this association overriding mechanism...
Would you have any docs/tips on that ? As for the SQL tutorial I'm fine, thanks ^^ Thanks, Olivier On 4 juil, 15:28, Smelly_Eddie <[EMAIL PROTECTED]> wrote: > What are you getting at? > > WHERE id =1 > > WHERE id IN 1, 2, 3 > > FIndAll does not use an ID, it uses a list of all ID's. > > Why is your model called resource pulling from a table named mark? > > It seems like your trying to JOIN resource results with averages, you > need a join query to do that. > > Hit up an SQL tutorial, then you should have all you need. > > On Jul 4, 6:43 am, OLance <[EMAIL PROTECTED]> wrote: > > > Nobody had the same issue ? > > > On 18 juin, 11:27, OLance <[EMAIL PROTECTED]> wrote: > > > > Hi everybody, > > > > I've got an issue with the {$__cakeID__$} value in a finderQuery : > > > > I have a Resource model and a Mark model, with these associations : > > > Resource hasMany Mark > > > Mark belongsTo Resource > > > > Mark is a simple model with an id, a value and of course a > > > resource_id. What I'd like to do is, instead of getting all my marks > > > when fetching a Resource model, to compute the average mark for this > > > Resource. > > > > So I tried to use the finderQuery param and obviously used {$__cakeID__ > > > $} to get my average calculated with the proper marks : > > > > "finderQuery" => 'SELECT AVG(Mark.value) AS average FROM res_marks AS > > > Mark WHERE Mark.resource_id = {$__cakeID__$}' > > > > I'm not so sure I can use finderQuery for that, but I bet it's made > > > for it... the problem is that it generates an wrong query when I try a > > > $this->Resource->findAll() : > > > > SELECT AVG(Mark.value) AS average FROM res_marks AS Mark WHERE > > > Mark.resource_id = 1, 2 > > > > This is the generated query if I have two Resources of id 1 and 2 in > > > my database... if I add a new one with id=5, it generates > > > Mark.resource_id =1, 2, 5... > > > > I don't understand this behaviour, and I've found no one with this > > > problem... does anyone have an idea on it ? Am I doing something > > > wrong ? > > > > Thanks a lot, > > > OLance --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---