Skip to content

Commit 80aafec

Browse files
committed
wip - use the new bundle structure
1 parent c4f8d2c commit 80aafec

File tree

7 files changed

+41
-84
lines changed

7 files changed

+41
-84
lines changed

src/Resources/config/makers.xml renamed to config/makers.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" ?>
22

3+
4+
5+
36
<container xmlns="http://symfony.com/schema/dic/services"
47
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
58
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
File renamed without changes.

src/DependencyInjection/Configuration.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

src/DependencyInjection/MakerExtension.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/MakerBundle.php

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,52 @@
1414
use Symfony\Bundle\MakerBundle\DependencyInjection\CompilerPass\MakeCommandRegistrationPass;
1515
use Symfony\Bundle\MakerBundle\DependencyInjection\CompilerPass\RemoveMissingParametersPass;
1616
use Symfony\Bundle\MakerBundle\DependencyInjection\CompilerPass\SetDoctrineAnnotatedPrefixesPass;
17+
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
1718
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
1819
use Symfony\Component\DependencyInjection\ContainerBuilder;
20+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
21+
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
1922
use Symfony\Component\HttpKernel\Bundle\Bundle;
2023

2124
/**
2225
* @author Javier Eguiluz <[email protected]>
2326
* @author Ryan Weaver <[email protected]>
2427
*/
25-
class MakerBundle extends Bundle
28+
class MakerBundle extends AbstractBundle
2629
{
30+
public function configure(DefinitionConfigurator $definition): void
31+
{
32+
$definition->rootNode()
33+
->children()
34+
->scalarNode('root_namespace')
35+
->defaultValue('App')
36+
->end()
37+
->end()
38+
;
39+
}
40+
41+
public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void
42+
{
43+
$container->import('../config/services.xml');
44+
$container->import('../config/makers.xml');
45+
46+
$rootNamespace = trim($config['root_namespace'], '\\');
47+
48+
$container->services()
49+
->get('maker.autoloader_finder')
50+
->arg(0, $rootNamespace)
51+
->get('maker.generator')
52+
->arg(1, $rootNamespace)
53+
->get('maker.doctrine_helper')
54+
->arg(0, $rootNamespace)
55+
;
56+
57+
$builder
58+
->registerForAutoconfiguration(MakerInterface::class)
59+
->addTag(MakeCommandRegistrationPass::MAKER_TAG)
60+
;
61+
}
62+
2763
public function build(ContainerBuilder $container): void
2864
{
2965
// add a priority so we run before the core command pass

src/Resources/config/maker.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is the old maker.xml... why is github complaining abaout a merge conflict....

0 commit comments

Comments
 (0)