0
votes

I am refactoring a few classes I wrote a while ago, into my Symfony project (v1.3.2 with Propel ORM).

The classes originally used direct connections to the database, I want to refactor those classes (stored in $(SF_LIB_DIR)) so that I can call propel and also use the ORM objects.

To clarify, So for example, I want to be able to use code like this in my custom classes:

try {
$con = Propel::getConnection();
$c = new Criteria();
$foo = new PropelORMFooObject();
$foobar =  PropelORMFooBarObjectPeer::fetch($c);

//set fields etc
$foo->setFooBar($foobar);

// now save using obtained connection ..
$foo->save($con)
}catch(SomeException $e)
{
  //deal with it
}

I assume that I will need to add some require_once() statements to my custom libraries, but it is not clear which files to include. Does anyone know how to do this?

1

1 Answers

1
votes

I'm not sure what you're getting at. As long as your executing this code from within a symfony application, the Propel classes will be brought into the execution context by the autoloader.

Are you actually getting "class not defined" errors?