Hi Andrei, my first kneejerk feeling is that you are not paying attention to my previous reply with the schema attached.
but i am going to ignore that feeling and assume that probably it was my communication that was bad. 1) let me rephrase the schema again. User -id -email -password -name Merchant -id -user_id -shop_id -owner Shop -id -name -description Domain -id -domain -primary Once again, the associations are that: User hasOne Merchant Shop hasMany Merchant Shop hasMany Domain I am looking to grab data from Merchant model. The conditions are Domain.primary =1 User.email = a...@a.com Merchant.owner = 1 I want to grab the FIRST data row that matches the conditions. the datarow must have data from all 4 models. 2) No i have not tried the find all with recursive 2 there are 3 reasons: 1) my joins is already working. my purpose in starting this thread is to see if a) i can do it in containable because i am forseeing a lot of similar (complex find) situations cropping up down the line and if Containable behavior is core then there must be a good reason to use it over joins. b) i REALLY REALLY want to get better at cakephp hence understanding and studying Containable a core behavior is essential since my joins is already working i have less inclination to try out the find all with recursive 2. 2) my merchants and shops and users model have 4 to 6 Other models tied to them EACH. Recursive 2 would be mean retrieving a lot of data. I am assuming this from the docs i read in book.cakephp.org esp the articles on Containable. in fact this is the very reason why Containable was promoted to solve this very same issue. Unless of course i misinterpret your meaning. then i shall try it out. but only if you give me exact details. I am a 1 month old in terms of cake usage despite reading the docs extensively i may still need quite a bit of hand holding. 3) i want to find the first datarow that matches the condition not ALL. minor point of course i could easily change it to find first with recursive 2 but then reason 2 would still stand. I am truly sorry if what i said is rude or offends you. At work and at home, i have been labelled as harsh and insensitive. At times i wonder if i am autistic. But this (obsessive) search to understand how the heck to get complex search right and get a true understanding of cake is driving me to go full out to seek answers so please forgive me should you be offended. Thank you. On May 4, 7:49 pm, Andrei Mita <andrei.m...@gmail.com> wrote: > I'm having a hard time understanding your problem, probably it's just me, > I'm not having a good time at work. > > So, if you have 4 tables all linked together (it doesn't matter if Shop > links to User through Merchant), than my guess is that Containable would be > the quickest way to get the data you want from all 4 tables. > > As I said in a previous e-mail. Do you know what you get if you do a > find('all') with $recursive = 2? How much of that information you don't > need. > > I can help you in two ways: either you give me the table structures and an > example of what you want OR i can post a containable query from one of my > projects that gets data from 4-5 different tables, as an example. > > > > > > On Tue, May 4, 2010 at 2:06 PM, Kei Simone <kimc...@gmail.com> wrote: > > i have the following for my cake 1.3: > > > User hasOne Merchant (so Merchant belongsTo User) > > Shop hasMany Merchant (so Merchant belongsTo Shop as well.) > > Shop hasMany Domain (so Domain belongsTo Shop.) > > > i need to use Merchant model to do a find of all 4 related data. > > > i need to find the first datarow that matches conditions for Merchant, > > User and Domain. > > > Merchant.owner = 1 > > User.email = a...@a.com > > Domain.domain =http://abc.example.com > > Domain.primary = 1 > > > the datarow must contain data from all 4 models. > > > the find must be done inside the Merchant model. as in $this->find... > > > Love to hear more from you about Containable. Really interested to see > > how powerful Containable is. > > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with > their CakePHP related questions. > > 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 > cake-php+unsubscr...@googlegroups.com For more options, visit this group > athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en