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.
on the otherhand throws an excpetion.
$con = Propel::getConnection('propel');
First, it was important to check that config/schema.xml is correct
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,
but it still wouldn’t load my sfPropelAutoload class. Adding the following made it start working…
Related posts:
Thanks.
you are the first one that solve my fucking problem.
Good post.
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
??
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!