Well, they're both good ideas, but...
1. Checking for a double-POST would be the responsibility of the
Controller, not the Model. The Controller already has a method called
postConditions, which allows you to turn a POSTed data array into one
suitable for passing as a set of conditions to find/findAll, so you
could do something like this:
// Checks to see if the same data was POSTed in the last 2 minutes
$conditions = am($this->postConditions($this->data), array('created' =>
'> '.date('Y-m-d H:i:s', strtotime('2 minutes ago'))));
if ($this->Model->hasAny($conditions)) {
// User POSTed twice
}
2. This is already handled by AppController. You can add additional
models, helpers, components and properties which will automatically be
added to all controllers.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---