On Jun 16, 6:54 pm, Femi Taiwo <[email protected]> wrote:
> Hi James,
> Yes, you  understand the scenario correctly.
> The problem with using contain in particular situation  is that multiple 
> queries are being generated in that find, and variables are being passed back 
> and forth between php and mysql - this much I see from the sql logs....so I 
> would be  kinda back to where I started.
> I'm giving the custom query option a try right now to see the results.
> Femi

You seem to have a simple (single) query with joins blown up into some
massive overly intensive logic.

If you rewrite your db structure as the following:

User
    hasOne(Relevant) UserDegree
    hasOne(Relevant) Certification
    hasOne(Relevant) Skill
    hasOne(Relevant) Language
    belongsTo City

Youve already got 1 query giving you the possibility to do exactly
what you want.

If there is a requirement for multiple matches for the same type (so
that you can say speaks German AND French)  - you'd bind a second
association with a different alias to it.

See
http://mark-story.com/posts/view/using-bindmodel-to-get-to-deep-relations

or the habtm docs in the book for more info, or numerous posts in the
group regarding habtm searching/filtering (yes, your question isn't
about habtm, but the answer is the same).

hth,
AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to