Symfony 2 FAQ

I recently started to work with symfony 2, a really nice PHP framework. Like Zend but with different concepts. While working with it I will line out some problems I had and solutions I found. This page will gradually be updated.

CLI says on doctrine:schema:create : No Metadata Classes to process.

If you’ve done everything following the documentation this error occurred because there is some inconsisty between the documentation and the implementation.The documentation says (for the PHP annotations) to put @ORM\Entity tags in the docblock. The real syntax is @orm:Entity. This behaves the same for all the other tags too (@orm:Table, @orm:Id, …)

Thanks to Johannes Heinen for lining that out in his blog entry

edit: According to Symfony’s blog entry from 2 days ago the documentation is correct. So update to the new beta is necessary. If you stay before Beta 2 then my decription is for you.

InvalidConfigurationException: Unrecognized options “annotations” under “framework.validation”

You want to validate forms using annotation? The documentation says to enable validation for annotations in the config file. But there is a spelling mistake in the example code. The correct line is:

# hello/config/config.yml
framework:
    validation: { enabled: true, enable_annotations: true }

  • emmanuel

    ContextErrorException: Warning: date_default_timezone_get() [function.date-default-timezone-get]:
    It is not safe to rely on the system’s timezone settings. You are
    *required* to use the date.timezone setting or the
    date_default_timezone_set() function. In case you used any of those
    methods and you are still getting this warning, you most likely
    misspelled the timezone identifier. We selected ‘Europe/London’ for
    ’0.0/no DST’ instead in C:wampwwwSymfonyappcachedevclasses.php
    line 5352

    when I start my browser it displays this message

  • http://tylkowski.net Matthias Tylkowski

    Like the message says, you have to set date.timezone in your php.ini or use the date_default_timezone_set() function in your index.php