Getting CREATE SQL for single Doctrine entity in Symfony2

I needed to create a new table for a single new Doctrine entity into an existing database.

I was in hurry and couldn’t find a solution so came up with my own.

Dump the whole SQL into a file:

php app/console doctrine:schema:create --dump-sql > dump.sql

For fixing lowercase table name I found a solution at

 * NAMESPACE\ExampleBundle\Entity\User
 * @ORM\Entity
 * @ORM\Table(name="user")
class User

Author: Michal Zuber

Full stack developer, biker and rollerblader. Owner and developer at Co-founded Blog at

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s