Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make db.orm.class_path optional #6

Merged
merged 1 commit into from
May 12, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand All @@ -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(),
'db.orm.cache' => new Doctrine\Common\Cache\ApcCache(),
4 changes: 3 additions & 1 deletion lib/Nutwerk/Provider/DoctrineORMServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down