Is there any inline method to collect all validation errors? Now I'm doing this:
$errors = '';
foreach($model->attributeNames() as $attr)
{
$errors .= $model->hasErrors($attr) ? $model->getErrors($attr) : '';
}
I think this is redundant.
You could simply use getErrors without param, it will returns the errors for all attribute.
You could also use Chtml::errorSummary, it will displays a summary of validation errors for one or several models.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With