Skip to content

Commit

Permalink
Add "stof_doctrine_extensions" app config.
Browse files Browse the repository at this point in the history
  • Loading branch information
igor committed Feb 21, 2017
1 parent bfeed0a commit 669853a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
20 changes: 19 additions & 1 deletion DependencyInjection/DarvinUtilsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@
use Darvin\Utils\DependencyInjection\ConfigInjector;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Yaml\Yaml;

/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class DarvinUtilsExtension extends Extension
class DarvinUtilsExtension extends Extension implements PrependExtensionInterface
{
/**
* {@inheritdoc}
Expand Down Expand Up @@ -61,4 +63,20 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('mailer.yml');
}
}

/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container)
{
$fileLocator = new FileLocator(__DIR__.'/../Resources/config/app');

foreach ([
'stof_doctrine_extensions',
] as $extension) {
if ($container->hasExtension($extension)) {
$container->prependExtensionConfig($extension, Yaml::parse(file_get_contents($fileLocator->locate($extension.'.yml')))[$extension]);
}
}
}
}
7 changes: 7 additions & 0 deletions Resources/config/app/stof_doctrine_extensions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
stof_doctrine_extensions:
orm:
default:
loggable: true
sortable: true
timestampable: true
tree: true

0 comments on commit 669853a

Please sign in to comment.