symfony2 Catchable Fatal Error: Object of class could not be converted to string

前端 未结 5 615
眼角桃花
眼角桃花 2020-12-05 01:45

I have this Entity defined:



        
5条回答
  •  执念已碎
    2020-12-05 02:44

    I got the same error but i tweaked it a little bit by adding:

    public function __toString() 
    {
        return (string) $this->name; 
    }
    

    I'm sure i was getting null instead of a string value. (I was working with sonata-project).

提交回复
热议问题