title: Creating a Symfony 4 Form without Database
body: <p>I'm new to symfony and want to to create a simple contact form, take the submitted values and send them as an Email. I don't want to save anything in the database.</p>
  <p>I followed the documentation on this page: <a href="https://symfony.com/doc/current/form/without_class.html" rel="nofollow noreferrer">https://symfony.com/doc/current/form/without_class.html</a></p>
  <p>I created a new page/action with the code from the page above:</p>
  <pre class="lang-php prettyprint-override"><code>    /**
       * @Route(&quot;/contact&quot;, name=&quot;page_contact&quot;)
       */
      public function contact(Request $request)
      {
          $defaultData = ['message' =&gt; 'Type your message here'];
          $form = $this-&gt;createFormBuilder($defaultData)
              -&gt;add('name', TextType::class)
              -&gt;add('email', EmailType::class)
              -&gt;add('message', TextareaType::class)
              -&gt;add('send', SubmitType::class)
              -&gt;getForm();
  
          $form-&gt;handleRequest($request);
  
          if ($form-&gt;isSubmitted() &amp;&amp; $form-&gt;isValid()) {
              // data is an array with &quot;name&quot;, &quot;email&quot;, and &quot;message&quot; keys
              $data = $form-&gt;getData();
          }
  
          return $this-&gt;render('Shop/contact.html.twig', [
              'form' =&gt; $form
          ]);
      }
  </code></pre>
  <p>But this gives me an error:</p>
  <pre><code>Symfony\Component\Form\Exception\InvalidArgumentException:
  Could not load type &quot;Doctrine\DBAL\Types\TextType&quot;: class does not implement &quot;Symfony\Component\Form\FormTypeInterface&quot;.
  
    at vendor/symfony/form/FormRegistry.php:89
    at Symfony\Component\Form\FormRegistry-&gt;getType('Doctrine\\DBAL\\Types\\TextType')
       (vendor/symfony/form/FormFactory.php:74)
    at Symfony\Component\Form\FormFactory-&gt;createNamedBuilder('name', 'Doctrine\\DBAL\\Types\\TextType', null, array())
       (vendor/symfony/form/FormBuilder.php:97)
    at Symfony\Component\Form\FormBuilder-&gt;create('name', 'Doctrine\\DBAL\\Types\\TextType', array())
       (vendor/symfony/form/FormBuilder.php:256)
    at Symfony\Component\Form\FormBuilder-&gt;resolveChildren()
       (vendor/symfony/form/FormBuilder.php:206)
    at Symfony\Component\Form\FormBuilder-&gt;getForm()
       (src/Controller/ShopController.php:68)
    at App\Controller\ShopController-&gt;contact(object(Request))
       (vendor/symfony/http-kernel/HttpKernel.php:149)
    at Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(object(Request), 1)
       (vendor/symfony/http-kernel/HttpKernel.php:66)
    at Symfony\Component\HttpKernel\HttpKernel-&gt;handle(object(Request), 1, true)
       (vendor/symfony/http-kernel/Kernel.php:190)
    at Symfony\Component\HttpKernel\Kernel-&gt;handle(object(Request))
       (public/index.php:37)
  </code></pre>
  <p>What am I doing wrong? Why is there all the <code>Doctrine</code> stuff in the Stack Trace?</p>