Error when I try to call a form Here is my class:

&lt;?php

namespace Drupal\mais\Form;

use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Ajax\AjaxResponse;
use Drupal\Core\Ajax\ChangedCommand;
use Drupal\Core\Ajax\HtmlCommand;
use Drupal\Core\Ajax\CssCommand;
use Drupal\Core\Ajax\InvokeCommand;
use Drupal\Core\Form\FormBase;
use Drupal\mais\Form\annuaireForm;
use Drupal\Core\Datetime\DrupalDateTime;

/**
 * Form controller for adhesion edit forms.
 *
 * @ingroup mais
 */
class adhesionForm extends ContentEntityForm {

    public function getFormId() {
    return 'adhesion_form';
    }

   /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    /* @var $entity \Drupal\mais\Entity\adhesion */
    $form['#theme'] = 'adhesion_form';
    $form = parent::buildForm($form, $form_state);

    $entity = $this-&gt;entity;

    //pour l'ajax
    if (!$form_state-&gt;has('entity_form_initialized')) {
    $this-&gt;init($form_state);
    }

    $form['add_annuaire'] = array(
       '#weight' =&gt; '-9',
      '#type' =&gt; 'button',
      '#value' =&gt; "Ajouter une fiche a l'annuaire",
      '#ajax' =&gt; array(
        'callback' =&gt; 'Drupal\mais\Form\adhesionForm::addAnnuaireCallback',
        'event' =&gt; 'click',
        'progress' =&gt; array(
          'type' =&gt; 'throbber',
          'message' =&gt; 'Création du formulaire',
        ),

      ),
    );
  /**
   * {@inheritdoc}
   */
  public function save(array $form, FormStateInterface $form_state) {
    $entity = $this-&gt;entity;

    $status = parent::save($form, $form_state);

    switch ($status) {
      case SAVED_NEW:
        drupal_set_message($this-&gt;t('Created the %label adhesion.', [
          '%label' =&gt; $entity-&gt;label(),
        ]));
        break;

      default:
        drupal_set_message($this-&gt;t('Saved the %label adhesion.', [
          '%label' =&gt; $entity-&gt;label(),
        ]));
    }
   //$form_state-&gt;setRedirect('entity.adhesion.canonical', ['adhesion' =&gt; $entity-&gt;id()]);
    $form_state-&gt;setRedirect('view.intranet_adhesion.page_1', ['adhesion' =&gt; $entity-&gt;id()]);
  }
  public static function addAnnuaireCallback(array &amp;$form, FormStateInterface $form_state) {

    $AddAnnuaireForm = \Drupal::formBuilder()-&gt;getForm('Drupal\mais\Form\annuaireForm');
    //return $AddAnnuaireForm;

    $ajax_response = new AjaxResponse();
    $ajax_response-&gt;addCommand(new HtmlCommand('#div-cible', buildAnnuaire));

   return $ajax_response;


  }


}


In the addAnnuaireCallback function,  the line 

​​​​​​​$AddAnnuaireForm = \Drupal::formBuilder()-&gt;getForm('Drupal\mais\Form\annuaireForm');


return an error:

Error: Call to a member function getEntityTypeId() on null in Drupal\Core\Entity\EntityForm-&gt;getBaseFormId() (line 79 of Drupal/Core/Entity/EntityForm.php).
Your form is a ContentEntityForm, so you need to use the entity form builder service, e.g.:

$entity = /** create or load your entity **/
$entity_form = \Drupal::service('entity.form_builder')
  -&gt;getForm($entity, 'default');