I've the following FormBuilder in a Form/*Type.php class:
<?php
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('tpmTargetId', null, array('label' => 'Target', 'required' => true))
->add('tpmSourcePropertyId', 'entity', array( 'label' => 'Global property', 'class' => 'TI\ML\SyncBundle\Entity\MlProperties'))
;
}
The problem is with the field tpmSourcePropertyId, when creating a new entry it displays the correct options in the dropdown field and when saving it inserts the correct ID but when trying to edit that entry the dropdown defaults to option #1 instead of the saved ID.
If I render the field a type text it shows the correct ID stored.
I've seem this question but I seem to be already using the proposed solution.
What could I do to debug this? Thank you!
--------- UPDATED
\config\doctrine\MlTargets.orm.yml
tarEmpPropertyId:
type: integer
nullable: false
unsigned: true
comment: ''
column: tar_emp_property_id
Entity\MlTargets.php
/**
* @var integer
*/
private $tarEmpPropertyId;
/**
* Set tarEmpPropertyId
*
* @param integer $tarEmpPropertyId
* @return MlTargets
*/
public function setTarEmpPropertyId($tarEmpPropertyId)
{
$this->tarEmpPropertyId = $tarEmpPropertyId;
return $this;
}
/**
* Get tarEmpPropertyId
*
* @return integer
*/
public function getTarEmpPropertyId()
{
return $this->tarEmpPropertyId;
}