1

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 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.