我有兩個實體市一對多Anagrafic, 我就與外地AnagraficType城市形式(使用隱藏的屬性,因爲使用JavaScript機頭)以這樣的方式Symfony2的ManyTo一個關係形式
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
我不明白什麼是錯的!
這將是* Anagraphic *。 – moonwave99 2013-02-19 16:03:46