Q:

How to use two entity at the same time

I have two entity calcPara calcSet.
I would like to make one form with this form.
I can make each form like these 
$calcPara = new CalcPara();
$form = $this->createFormBuilder($calcPara)->add('save', SubmitType::class)
    ->getForm();

$calcSet = new CalcSet();
$form = $this->createFormBuilder($calcSet)->add('save', SubmitType::class)
    ->getForm();

However this makes two defferent form.
But I want to make one form from two entities.
How can I make it??

A:

In Symfony a Form has a single object as the data backing it, so you can't directly assign two Entities to play that role.  Without going completely manual with building the form, you could instead do some preparatory work combining the two Entities into a new type which you defined containing the important members from both Entities.  However, you would have to be responsible for translating the two Entites into the new object, and back again when the form is submitted.
e.g. 
class CalcSetAndPara {

    public function setSetValue($setValue) {}
    public function getSetValue() {}
    public function setParaValue($paraValue) {}
    public function getParaValue(){}
}

And using it:
$combinedObject = new CalcSetAndPara();
$combinedObject->setSetValue($calcSet->getValue());
$combinedObject->setParaValue($calcPara->getValue());

$form = $this->createFormBuilder($combinedObject)->add('save', SubmitType::class)
    ->getForm();

//Then handle and do whatever you need to do with the results, extracting and persisting the two entities

