I have a table with a unique index present in the table. What is the
best method for preventing insertion of a duplicated record?
Currently I have code similar to:
if( !$this->Thing->save( $this->data ) )
{
$this->Session->setFlash(__('The thing was not saved. Please, try
again.', true));
}
How would I say, if save() failed, but it failed because of a
duplicate, then there is not an error?
Also, is this the best way of handling duplicate record inserts? Is
there a better way, for instance using the model or some other method?
Thanks
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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