my life

day to day

Archive for August 17th, 2007

PropelException: No connection params set for propel

Friday, August 17th, 2007

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

add to del.icio.us    add to technorati favs   email this

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

Friday, August 17th, 2007

I was getting this error today on a new Symfony project. The problem was that I had defined the schema in the schema.xml file, but there was a conflicting schema.yml file that sat empty. Removing (

rm -f config/schema.yml
fixed my problems and propel-build-model + propel-build-sql succeeded.
Execution of target “sql-template” failed for the following reason: /home/eosterman/metaphr/trunk/lib/symfony-1.0.6/lib/vendor/propel-generator/build-propel.xml:187:1: No package found for database “” in generated-schema.xml. The propel.packageObjectModel property requires the package attribute to be set for each database. [phingcall] /home/eosterman/metaphr/trunk/lib/symfony-1.0.6/lib/vendor/propel-generator/build-propel.xml:187:1: No package found for database “” in generated-schema.xml. The propel.packageObjectModel property requires the package attribute to be set for each database.

add to del.icio.us    add to technorati favs   email this