I have various models that represent tables in my database with required fields. I see that if a field is set to NOT NULL, Phalcon generates a
PresenceOf type validator and outputs an error message when saving if that field is empty.
For example, my
username field may be set to NOT NULL in the database. If you fail to set a value for that field before saving, Phalcon outputs :
username is required. I do not want this message being output.
I notice that if I add my own
PresenceOf validator for that field, it is simply ignored and the generated one executes first.
I need to do one of two things:
- Alter the message generated by the generated validators.
- Remove the default validators (preferably specific ones, not globally).
Is there some method of accomplishing one (or both) of these things?
- Bonus Question Since posting this question, I've noticed that when I enter a string value for an integer type database field, Phalcon doesn't reach my
Numericalityvalidator and instead spits out that damn
field_name is requiredmessage. Non-numeric != empty. How can I end this madness?