title: Symfony 4 : Call to a member function get() on null
body: <pre><code>class EtudiantController extends AbstractController
  {
  
      private $etudiant ;
      private  $form ;
  
      public function  __construct()
      {
          $this-&gt;etudiant = new Etudiant();
          $this-&gt;form = $this-&gt;createForm(EtudiantType::class, new Etudiant());
  
      }
  }
  </code></pre>
  
  <p>** i'v got an error when instantiate a form in a constructor using the <code>createForm()</code> function **<a href="https://i.stack.imgur.com/LbrOL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LbrOL.png" alt="enter image description here"></a></p>