From b2230a60c385479bf70dd35349532cf883163fec Mon Sep 17 00:00:00 2001 From: Arno Moonen Date: Sat, 12 May 2012 19:34:37 +0200 Subject: [PATCH] Made the db.orm.class_path parameter optional (as is suggested in the Silex documentation). --- README | 3 ++- lib/Nutwerk/Provider/DoctrineORMServiceProvider.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README b/README index ea3cf30..e2f371c 100644 --- a/README +++ b/README @@ -26,6 +26,7 @@ $app->register(new Nutwerk\Provider\DoctrineORMServiceProvider(), array( )), )); +Note: the db.orm.class_path parameter is optional (useful if you'd like to use another class loading mechanism than the one provided by Silex). By default this setup assumes you put your entities beneath app/Entity/* @@ -34,4 +35,4 @@ The EntityManager will be available by $app['db.orm.em'] By default the ArrayCache is used for doctrine caching. This may only be useful in development, so if you want to use another cache you can set it by adding the correspondig config key: -'db.orm.cache' => new Doctrine\Common\Cache\ApcCache(), \ No newline at end of file +'db.orm.cache' => new Doctrine\Common\Cache\ApcCache(), diff --git a/lib/Nutwerk/Provider/DoctrineORMServiceProvider.php b/lib/Nutwerk/Provider/DoctrineORMServiceProvider.php index 998ab4b..313045c 100644 --- a/lib/Nutwerk/Provider/DoctrineORMServiceProvider.php +++ b/lib/Nutwerk/Provider/DoctrineORMServiceProvider.php @@ -32,7 +32,9 @@ public function register(Application $app) $this->setOrmDefaults($app); $this->loadDoctrineOrm($app); - $app['autoloader']->registerNamespace('Doctrine\\ORM', $app['db.orm.class_path']); + if(isset($app['db.orm.class_path'])) { + $app['autoloader']->registerNamespace('Doctrine\\ORM', $app['db.orm.class_path']); + } } private function loadDoctrineOrm(Application $app)