2

I am trying to embed a subform to a form with EasyAdmin 3.

I have entity A that has a OneToOne relationship with entity B.

class entityA {
  
  private $id;

  private $name;

  //OneToOne with cascade persist
  private $entityB; 

}
class entityB {
  
  private $id;

  private $name;

  private $price;

}

In my Entity A CRUD Controller, how can I display the entity B form ?

public function configureFields(string $pageName): iterable
    {
        return [
            TextField::new('name'),
            // entity B form ?? (name, price)
        ];
    }

I tried CollectionType but it works only for...collection. It's not for OneToOne relations :(

eronn
  • 1,690
  • 3
  • 21
  • 53

1 Answers1

4
TextField::new('entityB.name'),
yaroslavche
  • 383
  • 1
  • 9