Sorry for posting. I figured it out.

$relates = $this->Post->find('matches', array(
        'model' => 'Tags',
        'contain' => false,
        'fields' => array('Post.id', Post.title),
        'scope' => array(
                        'Tag.name' => $tagged)));


Dave

-----Original Message-----
From: Dave Maharaj :: WidePixels.com [mailto:[email protected]] 
Sent: September-04-09 11:10 PM
To: [email protected]
Subject: Ad Hoc Joins Bakery


Has anyone used the Ad-hoc Joins in Model::find() as published in the
Bakery? 

I have it up and running but I would like to use contain. The results are
pulling way to much data for the tables.

$tagged =  Set::extract($post, 'Tag.{n}.name'); //get all tags for this Post

$relates = $this->Post->find('matches', array(
        'model' => 'Tags',
        'scope' => array(
                        'Tag.name' => $tagged)));

I only need to grab the Post.id and Post.title to create a simple "related
Posts" in the view, but right now its grabbing everything in Post and all
related relationship data..way too much

Can the query use contain? If so how to add it in or edit the code?

Thanks
 
Dave




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

  • Ad Hoc Joins Bakery Dave Maharaj :: WidePixels.com
    • RE: Ad Hoc Joins Bakery - SOLVED Dave Maharaj :: WidePixels.com

Reply via email to