class Book extends AppModel{
   var $hasAndBelongsToMany = array('Author', 'Tag');
   var $belongsTo = 'Publisher';
}

whats exactly the problem??


2010/10/5 georgeman <[email protected]>

> I'm looking for help with associations, specifically HABTM. What if
> you have more than one HABTM for a model? The parser won't allow it.
> So what to do? The manual doesn't seem to answer this question or
> perhaps it does but I didn't see it.
>
>
> This is my setup: If anybody can point our where I am mistaken I would
> be so grateful....
>
>
> I'm setting up a bookshelf application. My models are: Book, Author,
> Publisher, Tag
>
> In my scenario here is the logic:
>
> - Book can have one or more Author
> - Author can have one or more Book
> - Book can have one Publisher
> - Publisher can have one or more Book
> - Book can have one or more Tag
> - Tag can have one or more Book
>
> In my model classes I have set the associations up as follows
>
> class Book extends AppModel{
>    var $hasAndBelongsToMany = 'Author';
>    var $belongsTo = 'Publisher';
> }
>
> class Author extends AppModel{
>    var $hasAndBelongsToMany = 'Book';
> }
>
> class Publisher extends AppModel{
>    var $hasMany = 'Book';
> }
>
> class Tag extends AppModel{
>    var $hasAndBelongsToMany = 'Book';
> }
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> 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]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to