Fix errors

@dantleech Thanks for this great tutorial.

I followed your tutorial at symfony-cmf/symfony-cmf-docs. With this PR the code will work as you have mentioned in the tutorial. 

This would close symfony-cmf/symfony-cmf-docs#322.

Thanks