The possible associations is 'belongsTo', ''hasOne', 'hasMany', 'hasAndBelongsToMany'
Try (need an extra db table called and condition_remedy, check http://manual.cakephp.org/chapter/models to set up the extra table correctly) if rating only could relate to one condition 'condition' hasAndBelongsToMany 'remedy' 'remedy' hasAndBelongsToMany 'condition' 'remedy' hasMany 'rating' 'rating' belongsTo 'remedy' Or (need two extra db table called rating_remedy and condition_remedy, check http://manual.cakephp.org/chapter/models to set up the extra table correctly) if rating relates to many condition 'condition' hasAndBelongsToMany 'remedy' 'remedy' hasAndBelongsToMany 'condition' 'remedy' hasAndBelongsToMany 'rating' 'rating' hasAndBelongsToMany 'remedy' If the afterFind stills get messy I would try to remove that with an if statement ind the afterFind. Hard to say exactly when I don't see the code. You could paste your code here http://bin.cakephp.org/ and then post the URL here. On 6 Maj, 13:10, Stacey <[EMAIL PROTECTED]> wrote: > I thought about passing a var from the controller, but I'm not sure > how to do that on a row by row basis. The reason I'm doing this is > probably due to an error in my database logic. I have the following: > > 'condition' hasAndBelongsToMany 'remedy' > 'remedy' belongsToMany 'condition' > 'remedy' hasMany 'rating' > 'rating' belongsToMany 'remedy' > > I have an afterFind in my remedy model that calculates the overall > rating and puts the value into a calculated field. I run into a > problem if a condition does not yet have a remedy, because the > afterFind adds the calculated field and basically creates a blank row > with the one field in it. So, I'm trying to figure out how to avoid > this. > > On May 6, 4:32 am, hepper <[EMAIL PROTECTED]> wrote: > > > Why not > > > if (isset($var)) { > > // Do something with $var > > > } > > > On 6 Maj, 06:39, Stacey <[EMAIL PROTECTED]> wrote: > > > > Hi All, > > > > I'm having a problem trying to access 'hasField' in a view. I have a > > > calculated field that is only created if there is a value to put in > > > the field. So, I need to first check if the field is available before > > > I do something with it in my view. Is this possible? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
