I would probably use bindModel with conditions: http://groups.google.ca/group/cake-php/browse_thread/thread/dcbb867063e4696c/4fbbbd0bf6223330?lnk=gst&q=bindmodel&rnum=9#4fbbbd0bf6223330
On May 9, 1:08 pm, robechar <[EMAIL PROTECTED]> wrote: > This is the only way I have found to do this, but perhaps some one > knows a better method? > > this->A->hasMany['B']['fields'] = 'id'; > $this->A->findAll(); > > On May 8, 3:46 am, peper <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Let's say I've got two models A and B , and the relation is > > A hasMany B > > > Now I want to "findAll" A's with corresponding B's . > > > this->A->findAll() works OK. > > > I can specify fields from A > > > this->A->findAll(null,"A.ID"); > > > I've got only ID from A and a list of all B's > > > Now I want to specify fields from B. > > > this->A->findAll(null,"B.ID"); > > > It doesn't work. It's a SQL error, becasue Cake makes : > > "SELECT ...FROM 'a' as 'A' WHERE ..... " > > and there's no such collumn : "B.ID" > > > Is it possible to specify fields in hasMany relation ? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
