I need help figuring out how to set up my tables or logic or both for
figuring out how to set a 'due date' on events. I have:

'Company' hasMany 'Category', 'User'
'Category' hasMany 'Event'
'Category' belongsTo 'Interval' (rows in the interval table are: days,
months, years, etc.)
'User' hasMany 'Event'


The first question is how do I ensure that a user has only one event
in each category (no duplicates)? I suspect a 'unique' => true,
somewhere in a model but where?

The second question is where/how do I process the logic to set a 'due'
column in the 'event' table using the associated data? For example: A
user submits the add event form that has the user_id, category_id, and
completed (which is the date it was last completed). Let's say the
associated category that was selected is 'annual training' and is set
to 12 months for how often it needs to be completed. I need to add a
year to the 'completed' date that was submitted and store it in the
events table. How do I process the associated category data to set the
'due' column for the event? I think it should be done in beforeSave in
the Event model but I don't know how to get the category information
in $this->data to calculate when it should be due.

Am I going about this all wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to