Answer the question
In order to leave comments, you need to log in
Symfony: what and when to throw exceptions (validate)?
Something I read out the docks on the forms, and then the question has matured like a banal one, but I can’t figure it out.
Actually how to write a handler in the classical way. I used to do this in pure PHP:
<?php
$error = [];
if (false) {
$error['name_empty'] = 'Enter your name';
}
if (false) {
$error['text_empty'] = 'Enter article text';
}
if (!$error) {
// save/redirect
}
// допустим внизу форма или HTML просто
echo '<p>' . implode(', ', $error) . '</p>';
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question