I tried the recently released generators yesterday but I came across a problem. I was properly able to create database & entities. But as soon as I tried to create schema it started showing error like:
php app/console doctrine:schema:create
[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@Table" in class Acme\BlogBundle\Entity\Post was never imported.
doctrine:schema:create [--dump-sql] [--em[="..."]]
I finally found the problem, it was that the generated entity had annotations like:
/**
* Acme\BlogBundle\Entity\Post
*
* @Table()
* @Entity
*/
instead of:
/**
* Acme\BlogBundle\Entity\Post
*
* @ORM\Table(name="post")
* @ORM\Entity
*/
I had to add the table name in the @Table annotation and ORM\ manually to all the annotations.
Now the error has changed:
php app/console doctrine:schema:create
ATTENTION: This operation should not be executed in a production environment.
Creating database schema...
[Exception] DateTime::__construct(): 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 'Asia/Calcutta' for 'IST/5.0/no DST' instead.
doctrine:schema:create [--dump-sql] [--em[="..."]]
How can I fix the timezone error.
and I saw the Symfony Interactive Generators video, the entity is generated by default with @ORM\ . Only the table name was for manual addition. Why did my distribution generate it with incorrect annotations.
This is a PHP issue in your config set your timezone
There is usually a separate php.ini file for the console.
Run
php -i | grep "Configuration File"this will tell you where the ini file for the console located. Add or edit the timezone in that file:date.timezone = my/timezone.Or you could add
date_default_timezone_set()to the top of app/AppKernel.php.