I added this code to current Entity, and made a Doctrine schema update:
/**
* @var string
*
* @ORM\Column(name="ftt_code", type="string", nullable=true)
*/
private $fttCode;
/**
* @return string
*/
public function getFttCode()
{
return $this->fttCode;
}
/**
* @param string $fttCode
*/
public function setFttCode($fttCode)
{
$this->fttCode = $fttCode;
}
I also added this to a form builder:
->add('fttCode', TextType::class, ['label' => 'FTT Kód zóny', 'required' => false])
But when I insert a record into the db, this value is not inserted and it's null.
Does anyboby know where's the problem?
Edit:
Here's controller code
if ($form->isSubmitted() && $form->isValid()) {
$security = $this->get('app.be_security.service');
if ($security->isAdmin() === false) {
$providers = $security->getReferenceListByClass(Provider::class);
if(count($providers) == 1) {
$zone->setProvider($providers);
}
}
$em = $this->getDoctrine()->getManager();
$em->persist($zone);
$em->flush();
$this->addFlash('notice', $this->get('translator')->trans("forms.message.inserted"));
if($zone->isStreetDefinedZones()) {
return $this->redirectToRoute('zone_edit', ["id" => $zone->getId()]);
} else {
return $this->redirectToRoute('zone_index');
}
}
If you don't already have it, add
to the options resolver in your form type.
Then replace
with