title: Get parent entity id in CollectionType Admin
body: <p>I am creating an entity <strong>basketElement</strong> which is linked to a parent entity <strong>basket</strong> via Sonata\Form\Type\CollectionType instantiated admin. When creating the entity <strong>basketElement</strong> I also need to call a function of a service which needs the id of entity <strong>basket</strong>.</p>
  
  <p>For now, I have an admin:</p>
  
  <pre><code>class BasketAdmin extends AbstractAdmin {
      /**
       * @param \Sonata\AdminBundle\Form\FormMapper $formMapper
       */
      public function configureFormFields(FormMapper $formMapper): void
      {
          $formMapper-&gt;with('basket.group.basketElements')
              -&gt;add('basketElements', Sonata\Form\Type\CollectionType::class)
          ;
      }
  }
  </code></pre>
  
  <p>And the basketElements field admin is as following:</p>
  
  <pre><code>class BasketElementAdmin extends AbstractAdmin {
      /**
       * @param \Sonata\AdminBundle\Form\FormMapper $formMapper
       */
      public function configureFormFields(FormMapper $formMapper): void
      {
          $formMapper-&gt;with('basketElement.group.products')
              -&gt;add('basket', Sonata\AdminBundle\Form\Type\ModelHiddenType::class)
          ;
      }
  
      public function prePersist(){
          $this-&gt;myService-&gt;myFunction($this-&gt;getParent()-&gt;getSubject()-&gt;getId());
      }
  }
  </code></pre>
  
  <p>How can I access the parent entity?</p>