我有两个实体 City OneToMany Anagrafic,我以这种方式使用字段 AnagraficType city(使用隐藏属性,因为手机使用 javascript)制作表单:
class Anagrafic
{
/**
* @ORM\ManyToOne(targetEntity="City", inversedBy="anagrafics", cascade={"persist"})
* @ORM\JoinColumn(name="city_id", referencedColumnName="id")
*/
private $city;
//..
//..
class City
{
/**
* @ORM\OneToMany(targetEntity="Anagrafic", mappedBy="city", cascade={"persist"})
*/
private $anagrafics;
//...
//...
class AnagraficType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('comune', 'hidden')
当我将表单保存回给我时,此错误:
Warning: spl_object_hash() expects parameter 1 to be object,
string given in /var/www/MyBusiness0_1/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php line 1559
我不明白怎么了!