I wrote a function in BudgetRepository
that is called when inserting new data into Budget table. The function is:
public function addBudgetToClie
You should not build an update query for this case using a queryBuilder. Use OOP approach to update your entities.
if ($form->isValid()) {
$budgetEntity = $form->getData();
$manager->persist($budgetEntity);
$clientEntity = $Budget->find($form['client_id']->getData()->getId());
$clientEntity->setBudget($budgetEntity);
$manager->flush();
$this->addFlash('success', 'Novo orçamento adicionado');
return $this->redirect($this->generateUrl('panel_budgets'));
}