Hey Phalconista's,
have been emailing the dev's with some incongruencies in the documentation now, but maybe it's better to do it in this forum. I have a suggestion for the validation creation function in models
There is a super nice option to build models using the tools, i used one on a sql table with an ‘email’ field in it, and it automaticly it build a validation function for me. Super neat!
But the function looks like this
public function validation()
{
// validators
if ($this->validationHasFailed() == true) {
return false;
}
}
And in my code i did this in my signup action;
$consumerUser = new ConsumerUser();
$consumerUser->setEmail($email);
if (! $consumerUser->validation())
{
throw new ValidationException('Email could not be validated');
}
blatantly assuming (using a very ok email adres), it would pass validation.
Maybe it’s wise to modify the builder so that it either throws an exception or returns true when validation does pass; eg
public function validation()
{
// validators
if ($this->validationHasFailed() == true) {
return false;
}
** return true; **
}
or
public function validation()
{
// validators
if ($this->validationHasFailed() == true) {
**throw new ValidationException(‘fields do not validate’); **
}
}