I am creating an app that's similar to a punch clock in the way that it functions. The user enters a start and stop datetime and I need to do some validations. I need to check that there is not a previously entered "time block" in the database that conflicts with the data being entered. No two time blocks may overlap and I have additional rules also regarding how much time there needs to be in between two blocks.
I considered running a custom validation function on the 'start' field but I need to make sure that there is no time block overlapping the time period from 'start' to 'end'. I'm not sure how to go about this. Since it needs to check two fields (start and end) against the database should I run a function in beforeValidate() instead of in validate? Then should I validate the normal stuff such as date/time/ alphanumeric etc. in the validate portion of the model? What's the "best practice" way of doing it? Here is a picture of what I'm trying to do. http://kenfrey.net/block.png --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
