On 21.07.2009, at 16:34, Michal Charemza wrote:
On 1 Jul 2009, at 15:58, Mathias Böttcher wrote:Regarding the error message. You can retrieve possible from a validator using its getErrorMessage method. The validator can be accessed by using getChild method of the ValidationManager. I'm not sure if that's the way the problem should be solved... especially with translation in mind.Would a solution to this be at actually save the record with with the unique field *inside* the validator code? Therefore any database exception can be caught in the validator and "thrown" as an Agavi validation error. Therefore all validation messages and code is in the same place.
Don't. Validation should be idempotent and free of side effects.Imagine your validator succeeds, but ultimately, some other validator fails and the action is never run. Your record would still be persisted to the database at that point, which is not a good idea.
- David
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ users mailing list [email protected] http://lists.agavi.org/mailman/listinfo/users
