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 :(

1 Answer 1

3
TextField::new('entityB.name'),
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.