I have a site that listings mp3 files in various categories. The site is in CakePHP and I am using the CakePHP star rating plugin for the rating functionality. The songs are categorized based on Albums, Singer and Music director so I need to implement rating for each of these. The rating plugin now I am using has an option for specify the model. It's model class is something like this :
class Rating extends Model {
var $name = 'Rating';
var $validate = array(
'user_id' => array(
'rule' => array('maxLength', 36),
'required' => true
),
'model_id' => array(
'rule' => array('maxLength', 36),
'required' => true
),
'model' => array(
'rule' => 'alphaNumeric',
'required' => true
)
);
var $hasMany = array(
'Rating' => array(
'className' => 'Rating',
'foreignKey' => 'model_id',
'conditions' => array('Rating.model' => 'rating'),
'dependent' => true,
'exclusive' => true
)
);
}
It has option to specify the model name and model id so I think my issue will be fixed if I will be able to specify the model name or any other parameter along with this Array. As I am newbie in CakePHP, someone please help me to find a solution.
Please check the rating plugin I am talking about here:
http://bakery.cakephp.org/articles/schneimi/2010/08/19/ajax-star-rating-plugin-1