I found all products accordingly users by using Containable behavior.

code is:
$this->User->contain(array('Product'));
debug($this->User->find('all', array('conditions' => array('User.id'
=> $this->Auth->user('id')))));

But now don't know how to find all brands accordingly a users product?

Is CakePHP very complex for writing function for such query..because I
am trying it from last two days also no body is replaying me.

Please tell me how should I go ahead with this?

Thanks

On Oct 16, 12:18 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Sorry, I forget that I used this solution but could not succeed
>
> $brands = $this->User->Product->Brand->find('all',array(
>                                                       'fields' =>
> array('Brand.id','Brand.brand_name'),
>                                                'conditions' =>
> array('User.id' => $this->Auth->user('id')),
>                                                       'recersive' => 0)
>                                            );
>
> Please help me
>
> On Oct 16, 12:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
>
> > I have three Model with following association
> > 1 User
> > 2 Product
> > 3 Brand
>
> > User ------------HABTM(brands_users)----------Brand
> > Brand-----------HABTM(brands_products)----------Product
> > User-----------HABTM(products_users)----------Product
>
> > I want to find a list of all brands which product had been selected by
> > a user.
>
> > Means first user select some products then he will be select brands.
>
> > So I am unable to display all brands accordingly user's products
>
> > Thanks a lot you for my help
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to