Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-21 Thread NiteRain
My Problem is similar, however, I don't seem to understand. /models/user.php class User extends AppModel { public $name = 'User'; public $hasAndBelongsToMany = array( 'Fundraiser' => array( 'className

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx
It works! You guys rock. Thanks. On Mar 11, 7:28 am, ohcibi wrote: > if you have two different types of photos for your news, which should > use the same photo-model you can define other model-aliases. like > this: > > app/models/article.php: > var $hasAndBelongsToMany = array( >     'Photo'

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx
Thank you both for your responses.I will try these out and post back. On Mar 11, 7:28 am, ohcibi wrote: > if you have two different types of photos for your news, which should > use the same photo-model you can define other model-aliases. like > this: > > app/models/article.php: > var $hasAn

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread ohcibi
if you have two different types of photos for your news, which should use the same photo-model you can define other model-aliases. like this: app/models/article.php: var $hasAndBelongsToMany = array( 'Photo' => array( 'className' => 'Photo', // should be the name of the Photo- Mod

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread Xoubaman
Just model it like a normal HABTM relationship, no special syntaxis, and add the field in the database. When saving, try this: http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/ I haven't done it before, so i can't secure his fiability, but looks goo

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx
What's the syntax for adding an "extra field" to the $hasAndBelongsToMany var? Thank you for you response. On Mar 11, 2:43 am, Xoubaman wrote: > You can model it like a normal HABTM relationship with an extra field > named main_photo. > > On Mar 11, 8:30 am, mattalexx wrote: > > > My articles

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread Xoubaman
You can model it like a normal HABTM relationship with an extra field named main_photo. On Mar 11, 8:30 am, mattalexx wrote: > My articles have and belong to many photos. This is so when the photo > is seen somewhere else on the site, I can have a "see related > articles". Each article also has

Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx
My articles have and belong to many photos. This is so when the photo is seen somewhere else on the site, I can have a "see related articles". Each article also has one main photo. I can't seem to figure out the syntax for this in APP/models/article.php file and in APP/models/photo.php. --~--~---