tags:

views:

181

answers:

1

I have a PHP script, it is located in the same computer as my Symfony application.

Now the issue is how can I, in the PHP script, call the Symfony's model layer? The reason for me to ask this is because for the PHP script, it needs to access a database that Symfony application is accessing. So I think it might help if I can call the Model layer directly.

Of course I can do a raw SQL select in my independent PHP script, but that's not what I really wanted.

+3  A: 

This works for me, code taken from jobeet tutorial:

require_once('SYMFONY_DIR/config/ProjectConfiguration.class.php');
$configuration = ProjectConfiguration::getApplicationConfiguration( 'frontend', 'test', true);
new sfDatabaseManager($configuration);
$job = JobeetJobPeer::doSelectOne(new Criteria());
print_r($job);

You may want to adjust your path and configuration.

niteria