Doctrine2 CLI under Silex application

I got it running with Doctrine 2.3.1-DEV. Get doctrine provider using composer:

[prism key=”code-composer” language=”javascript”]

Create doctrine.php and put the following content inside. I like to put it in bin/doctrine.php:

[prism key=”code-cli” language=”php”]

And that’s it :)

3 Replies to “Doctrine2 CLI under Silex application”

  1. Better solution can be to use:

    new ConnectionHelper($app[‘db.orm.em’]->getConnection()),
    ’em’ => new EntityManagerHelper($app[‘db.orm.em’])


    // …


    This make possibile to add other command in the same console application and run it in a different moment.

  2. Fatal error: Uncaught exception ‘InvalidArgumentException’ with message ‘Identifier “db.orm.em” is not defined.’

    I had to use $app[‘orm.em’]

Leave a Reply

Your email address will not be published. Required fields are marked *