Why error occurs when the form is submitted?

Why do I get error occurs when sending related forms ? Please help.
Error:
Expected argument of type "int or null", "App\Entity\NetworkStatus" given at property path "idnetwork_status".

Controller
$this->company = new CompanyCard();
 $form = $this->createForm(CompanyCardType::class, $this->company);

$form->handleRequest($request);

 if($form->is submitted() && $form->isValid())
{
 $entityManager = $this->getDoctrine()->getManager();
$entityManager->persist($this->company);
$entityManager->flush();
}

 return $this->render('company/add.html.twig', [
 'form' => $form->createView(),
 ]);


In fact CompanyCard I make a connection with the essence of the Company
/**
 * @ORM\OneToOne(targetEntity="App\Entity\Company", cascade={"persist", "remove"})
 * @ORM\JoinColumn(name="idcompany", referencedColumnName="idcompany")
*/
 private $company;

public function getCompany(): ?Company
{
 return $this->company;
}

 public function setCompany(?Company $company): self
{
 $this->company = $company;

 return $this;
 }


CompanyCardType. Connect shapes with the companyType
->add('company', CompanyType::class)
In the CompanyType field on which rests the error
->add('idnetwork_status', EntityType::class,[
 'class' => NetworkStatus::class,
 'choice_label' => 'name_network',
 'query_builder' => function(EntityRepository $er)
{
 $qb = $er->createQueryBuilder('name_network');
 return $qb;
},
'label'=>false,
'multiple'=>false,
'expanded'=>true,
 ])
March 23rd 20 at 19:08
0 answer

Find more questions by tags Symfony