|
@@ -14,6 +14,7 @@ namespace Symfony\Component\Form;
|
|
|
use Symfony\Component\Form\Event\DataEvent;
|
|
|
use Symfony\Component\Form\Event\FilterDataEvent;
|
|
|
use Symfony\Component\Form\Exception\FormException;
|
|
|
+use Symfony\Component\Form\Exception\FormNotBoundException;
|
|
|
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
|
|
use Symfony\Component\Form\Exception\TransformationFailedException;
|
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
@@ -674,7 +675,11 @@ class Form implements \IteratorAggregate, FormInterface
|
|
|
*/
|
|
|
public function isValid()
|
|
|
{
|
|
|
- if (!$this->isBound() || $this->hasErrors()) {
|
|
|
+ if (!$this->isBound()) {
|
|
|
+ throw new FormNotBoundException('Can not validate a form that is not bound');
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($this->hasErrors()) {
|
|
|
|
|
|
return false;
|
|
|
}
|