Creating a Database With Symfony and Doctrine

Today, I created my first sample database using Symfony. In just a few steps I was able to have my db up and running. It was awesome!

First, I updated my db parameters in “parameters.yaml”. I was worried that this wouldn’t work because I’m using a Vagrant box¬†(Laravel Homestead) and you don’t really see examples for this approach in the documentation. So, I just added theconfig items (db host, port, name, user, etc.) the same way I have them configured in Sequel Pro. It worked.

Here’s a sample parameters.yml:

    database_port: 33060
    database_name: product_db
    database_user: homestead
    database_password: secret
    mailer_transport: smtp
    mailer_user: null
    mailer_password: null
    secret: dcc9090991abc12aaaadbb787111cee

Next, I created an Entity class. Continue reading