Skip to content

Commit

Permalink
Added configurable naming strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
Supericy committed Dec 22, 2014
1 parent 34417df commit 8b351f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config/doctrine.php
Expand Up @@ -4,7 +4,8 @@
'simple_annotations' => false,

'metadata' => [
base_path('app/models')
'paths' => [base_path('app/models')],
'naming_strategy' => null
],

'proxy' => [
Expand Down
5 changes: 4 additions & 1 deletion src/LaravelDoctrineServiceProvider.php
Expand Up @@ -81,7 +81,7 @@ private function registerEntityManager()
$this->app->singleton(EntityManager::class, function ($app) {
$config = $app['config']['doctrine::doctrine'];
$metadata = Setup::createAnnotationMetadataConfiguration(
$config['metadata'],
$config['metadata']['paths'],
$app['config']['app.debug'],
$config['proxy']['directory'],
$app[CacheManager::class]->getCache($config['cache_provider']),
Expand All @@ -92,6 +92,9 @@ private function registerEntityManager()
$metadata->setDefaultRepositoryClassName($config['repository']);
$metadata->setSQLLogger($config['logger']);

if (isset($config['metadata']['naming_strategy']))
$metadata->setNamingStrategy($app->make($config['metadata']['naming_strategy']));

if (isset($config['proxy']['namespace']))
$metadata->setProxyNamespace($config['proxy']['namespace']);

Expand Down

1 comment on commit 8b351f7

@kirkbushell
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the documentation to show that this is now supported, then I'll merge in.

Please sign in to comment.