| @@ 22-50 (lines=29) @@ | ||
| 19 | * |
|
| 20 | * @author jobou |
|
| 21 | */ |
|
| 22 | class ResolverCompilerPass implements CompilerPassInterface |
|
| 23 | { |
|
| 24 | /** |
|
| 25 | * {@inheritDoc} |
|
| 26 | */ |
|
| 27 | public function process(ContainerBuilder $container) |
|
| 28 | { |
|
| 29 | if (!$container->hasDefinition('jb_fileuploader.resolver_chain')) { |
|
| 30 | return; |
|
| 31 | } |
|
| 32 | ||
| 33 | $definition = $container->getDefinition( |
|
| 34 | 'jb_fileuploader.resolver_chain' |
|
| 35 | ); |
|
| 36 | ||
| 37 | $taggedServices = $container->findTaggedServiceIds( |
|
| 38 | 'jb_fileuploader.resolver' |
|
| 39 | ); |
|
| 40 | ||
| 41 | foreach ($taggedServices as $id => $tags) { |
|
| 42 | foreach ($tags as $attributes) { |
|
| 43 | $definition->addMethodCall( |
|
| 44 | 'addResolver', |
|
| 45 | array(new Reference($id), $attributes["alias"]) |
|
| 46 | ); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 22-50 (lines=29) @@ | ||
| 19 | * |
|
| 20 | * @author jobou |
|
| 21 | */ |
|
| 22 | class ValidatorCompilerPass implements CompilerPassInterface |
|
| 23 | { |
|
| 24 | /** |
|
| 25 | * {@inheritDoc} |
|
| 26 | */ |
|
| 27 | public function process(ContainerBuilder $container) |
|
| 28 | { |
|
| 29 | if (!$container->hasDefinition('jb_fileuploader.validator_chain')) { |
|
| 30 | return; |
|
| 31 | } |
|
| 32 | ||
| 33 | $definition = $container->getDefinition( |
|
| 34 | 'jb_fileuploader.validator_chain' |
|
| 35 | ); |
|
| 36 | ||
| 37 | $taggedServices = $container->findTaggedServiceIds( |
|
| 38 | 'jb_fileuploader.validator' |
|
| 39 | ); |
|
| 40 | ||
| 41 | foreach ($taggedServices as $id => $tags) { |
|
| 42 | foreach ($tags as $attributes) { |
|
| 43 | $definition->addMethodCall( |
|
| 44 | 'addValidator', |
|
| 45 | array(new Reference($id), $attributes["alias"]) |
|
| 46 | ); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||