PropelException: No connection params set for propel

I upgraded to a newer version of Symfony today (v1.0.6) and had a hell of time getting the trivial task of connecting to the database working.

I was able to obtain a connection, by doing


$databaseManager 
= new sfDatabaseManager();
$databaseManager->initialize();
$con $databaseManager->getDatabase('propel');


but that’s not the ideal way, and not the way symfony gets the database handle.


$con 
Propel::getConnection('propel');
on the otherhand throws an excpetion.

Fatal error: Uncaught exception ‘PropelException’ with message ‘No connection params set for propel’

First, it was important to check that config/schema.xml is correct

<database name=”propel” defaultIdMethod=”native”>

And that config/databases.yml has a connection profile for propel

All that was good. But for some reason sfPropelAutoload was not geting loaded.

If I manually included it


include './lib/symfony-1.0.7/lib/addon/propel/sfPropelAutoload.php'It was clearly listed in the autoloader.yml


it would work, but still not desirable.

The following was in my autoloader config,

propel_addon: name: propel addon files: Propel: %SF_SYMFONY_LIB_DIR%/addon/propel/sfPropelAutoload.php

but it still wouldn’t load my sfPropelAutoload class. Adding the following made it start working…

symfony_orm: name: symfony orm classes files: Propel: %SF_SYMFONY_LIB_DIR%/addon/propel/sfPropelAutoload.php Criteria: %SF_SYMFONY_LIB_DIR%/vendor/propel/util/Criteria.php SQLException: %SF_SYMFONY_LIB_DIR%/vendor/creole/SQLException.php DatabaseMap: %SF_SYMFONY_LIB_DIR%/vendor/propel/map/DatabaseMap.php

Related posts:

  1. Symfony – No package found for database “” in generated-schema.xml

3 comments

  1. Diego says:

    Thanks.

    you are the first one that solve my fucking problem.

    Good post.

  2. wendy says:

    hello,

    would you please tell me

    what is ?

    where I put these

    symfony_orm:

    name: symfony orm classes

    files:

    Propel: %SF_SYMFONY_LIB_DIR%/addon/propel/sfPropelAutoload.php

    Criteria: %SF_SYMFONY_LIB_DIR%/vendor/propel/util/Criteria.php

    SQLException: %SF_SYMFONY_LIB_DIR%/vendor/creole/SQLException.php

    DatabaseMap: %SF_SYMFONY_LIB_DIR%/vendor/propel/map/DatabaseMap.php

    ??

  3. petru says:

    There is a more simple explanation why this issue occurs and after a few times I discovered there is a simple pattern: the symfony library permissions!

    So I just run a chmod 0777 * -R inside the symfony libraries(make sure it's not publicly exposed because then you will have security issues with 0777) and it will have fixed your issues!
    ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

*