If you have Auction HABTM Cateory and you want to get auction and
categories you can use ContainableBehavior.
e.g. $this->Auction->find('all',array('contain'=>'Category'))
you can read more about ContainableBehavior
http://book.cakephp.org/view/474/Containable
and if you just want get Categories belongs to specified Auction you
can
$this->Auction->Category->find('all',
array('conditions'=array('Auction.id'=>$id)));
remember to set HABTM in both models.
also
$this->Auction->id = 2;
$this->Auction->Category->find('all'); // it will return ALL
categories, NOT categories belongs to Auction with id = 2
On 23 Paź, 01:34, cem <[EMAIL PROTECTED]> wrote:
> Hi I have auctions which can have more than one category . I want to
> get the categories which belongs to a specified auction .
>
> So the Category HABTM Auction . Thats Right because I can store data
> in the join table . My problem is :
>
> While fetching data what will I do ?
>
> $this->Auction->Category->find('all' ,array('conditions'...))
>
> was an advice from the chat which does not work any other ideas ?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---