I am following the book and on the page http://symfony.com/doc/current/book/doctrine.html
While following the book I am trying to work on relationship of product and cat
Check that the PHP opening and (optional) closing tags
and
?>
are correct in your file.
They are not included when you copy paste from the tutorial at http://symfony.com/doc/current/book/doctrine.html
I was stuck at the same problem. After looking at this post I started wondering why the syntax highlighting was broken and discovered that the opening and closing tags were missing. The error disappeared when the tags were included.