Thanks much for the help, but what exactly do you mean (and what syntax
should I use)?
Samuel DeVore wrote:
> try array('Logo.company_id'=>1,'Product.id'=>2)
>
> On 7/12/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> >
> > I have a HABTM relationship between Products and Logos. When I use
> > something like this:
> >
> > $this->set('data', $this->Product->find("id = 2", null, null, 1));
> >
> > The result is the following:
> >
> > Array
> > (
> > [Product] => Array
> > (
> > [id] => 2
> > [name] => Chase and Ken T-Shirt
> > [description] => Blandit autet irillam integer ...
> > [price] => 7.95
> > [quantity] =>
> > [active] => 1
> > [featured] => 0
> > [cart] => 1
> > [brand_id] => 0
> > [created] =>
> > [modified] =>
> > )
> >
> > [Logo] => Array
> > (
> > [0] => Array
> > (
> > [id] => 3
> > [name] => Screenprinted Gentex Logo
> > [location] => Back
> > [price] => 0.75
> > [company_id] => 1
> > )
> >
> > [1] => Array
> > (
> > [id] => 4
> > [name] => Screenprinted Serious Cams Logo
> > [location] => Breast
> > [price] => 0.50
> > [company_id] => 2
> > )
> > )
> > )
> >
> > However, when we end up having a bunch of logos, this result will be
> > enormous. How do I have the same result but limit the logos to having a
> > "company_id" of 1. I tried the following:
> >
> > $this->set('data', $this->Product->find("id = 2 AND company_id = 1",
> > null, null, 1));
> > $this->set('data', $this->Product->find("id = 2 AND logo.company_id =
> > 1", null, null, 1));
> >
> > But neither seemed to work; the error says field "company_id" not
> > found. What to do?
> >
> > Thanks in advance!
> >
> >
> > >
> >
>
> ------=_Part_241_20267607.1152747189681
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 4704
>
> try array('Logo.company_id'=>1,'<a
> href="http://Product.id">Product.id</a>'=>2) <br><br><div><span
> class="gmail_quote">On 7/12/06, <b class="gmail_sendername"><a
> href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a></b>
> <<a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>>
> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid
> rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>I have
> a HABTM relationship between Products and Logos. When I use
> <br>something like this:<br><br>$this->set('data',
> $this->Product->find("id = 2", null, null, 1));<br><br>The
> result is the
> following:<br><br>Array<br>(<br> [Product] =>
> Array<br> (<br> [id]
> => 2
> <br> [name]
> => Chase and Ken
> T-Shirt<br> [description]
> => Blandit autet irillam integer
> ...<br> [price]
> =>
> 7.95<br> [quantity]
>
> =><br> [active]
> => 1<br>
> [featured]
> =>
> 0<br> [cart]
> =>
> 1<br> [brand_id]
> =>
> 0<br> [created]
>
> =><br> [modified]
>
> =><br> )<br><br> [Logo]
> =>
> Array<br> (<br> [0]
> => Array
> <br> (<br> [id]
> =>
> 3<br> [name]
> => Screenprinted Gentex
> Logo<br> [location]
> =>
> Back<br> [price]
> =>
> 0.75<br> [company_id]
> => 1
> <br> )<br><br> [1]
> =>
> Array<br> (<br> [id]
> =>
> 4<br> [name]
> => Screenprinted Serious Cams
> Logo<br> [location]
> => Breast
> <br> [price]
> =>
> 0.50<br> [company_id]
> =>
> 2<br> )<br> )<br>)<br><br>However,
> when we end up having a bunch of logos, this result will be<br>enormous. How
> do I have the same result but limit the logos to having a
> <br>"company_id" of 1. I tried the
> following:<br><br>$this->set('data', $this->Product->find("id =
> 2 AND company_id = 1",<br>null, null, 1));<br>$this->set('data',
> $this->Product->find("id = 2 AND
> logo.company_id =<br>1", null, null, 1));<br><br>But neither seemed to
> work; the error says field "company_id" not<br>found. What to
> do?<br><br>Thanks in advance!<br><br><br>
> ------=_Part_241_20267607.1152747189681--
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---