0

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

1

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?

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

1 Comment

Ah, ok,. I was not aware that the autoloader makes the classes available to classes being used in the SF framework. I'll dopuble check to make double sure ...

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.