Uther Pendragon
Uther Pendragon

Reputation: 81

Get Doctrine Manager outside of Symfony

so I have a Symfony application and i have to make some cron job services that will run as deamons.

So i want to use normal php files without the whole framework - one custom class however needs the Doctrine Entity Manager.

How can I start this custom class with the Manager and the Doctrine structure from Symfony in a non-framework php file?

Upvotes: 0

Views: 758

Answers (1)

thesearentthedroids
thesearentthedroids

Reputation: 620

Is creating a standalone php file mandatory for you?

You can create console commands with symfony http://symfony.com/doc/current/cookbook/console/console_command.html

if you create a sf2 console command you can call doctrine this way:

$em = $this->getContainer()->get('doctrine')->getManager();

Upvotes: 1

Related Questions