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!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- How do I limit HABTM results with find function? [EMAIL PROTECTED]
- Re: How do I limit HABTM results with find function... Samuel DeVore
- Re: How do I limit HABTM results with find func... [EMAIL PROTECTED]
- Re: How do I limit HABTM results with find ... Samuel DeVore
