Symfony2 Doctrine2 trouble with optional one to one relation

后端 未结 5 1553
小蘑菇
小蘑菇 2021-01-01 12:53

I have a problem with Doctrine2 in Symfony2 and two relationed entities.

There is a user-entity that can (not must) have a usermeta-entity referenced which

5条回答
  •  温柔的废话
    2021-01-01 13:16

    I got the error message "spl_object_hash() expects parameter 1 to be object, null given in..." while trying the same thing. I tried to define a bidirectional One to One relationship while the inversed value could be null. This gave the error message. Taking away the inversed side of the relationship solved the problem. It is a pity that Zero or One to One relationships aren't supported.

提交回复
热议问题