I have this Entity defined:
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).