title: Symfony 2: How to catch Catchable Fatal Error?
body: <p>How do I catch this type of error?</p>
  
  <p><i>ContextErrorException: Catchable Fatal Error: Argument 1 passed to AA\SomeBundle\Entity\SomeEntity::setCity() must be an instance of AA\SomeBundle\Entity\City, null given, called in /srv/dev/some_path/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php on line 360 and defined in /srv/dev/some_path/src/AA/SomeBundle/Entity/SomeEntity.php line 788</i></p>
  
  <p>And I am trying to catch everything like that:</p>
  
  <pre><code>$form = $this-&gt;createForm(new SomeFormType(), $instanceOfSomeEntity);
  
  try {
      $form-&gt;handleRequest($request);
  } catch (\Exception $e) {
      $form-&gt;addError(new FormError('missing_information'));
  }
  </code></pre>