0
votes

I'm trying to connect propel and symfony2 together, but the only thing that I get is this exception:

No connection information in your runtime configuration file for datasource [symfony]

I used the propel bundle which I added to the composer, and I edited the kernel to include the bundle.

My config.yml propel conf looks like that:

propel:
    dbal:
        driver:               mysql
        user:                 root
        password:             null
        dsn:                  mysql:host=localhost;dbname=symfony;charset=UTF8
        options:              {}
        attributes:           {}

What can I be missing? I tried googling, but nothing really solves the issue.

1

1 Answers

2
votes

Okay, I solved the issue.

The problem lied in the config.yml file, where the propel dbal data should be stored. I initially put it the way they describe it in the manual, like that:

propel:
    dbal:
        driver:   "%database_driver%"
        user:     "%database_user%"
        password: "%database_password%"
        dsn:    "%database_driver%:host=%database_host%;dbname=%database_name%;charset=%database_charset%"

According to the manual on both the propel and symfony's sites, it is enough. However, this doesn't seem to be the case for some reason yet unknown to me. What I had to do was to explicitly state the connection and name it precisely - symfony, like that:

propel
    dbal:
        default_connection:         symfony
        connections:
            symfony:
                driver:               %database_driver%
                user:                 %database_user%
                password:             %database_password%
                dsn:                  %database_driver%:host=%database_host%;dbname=%database_name%;charset=UTF8

This way it worked. Sucks to be a junior developer sometimes.