Skip to content

Commit

Permalink
change services.xml to use setFactory() instead of `setFactoryServi…
Browse files Browse the repository at this point in the history
…ce() #5
  • Loading branch information
iteman committed Jun 13, 2015
1 parent 0e987dd commit 9567a2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\DefinitionDecorator;

class PHPMentorsProxyURLRewriteExtension extends Extension
{
Expand Down Expand Up @@ -51,12 +52,7 @@ private function transformConfigToContainerParameters(array $config, ContainerBu
if ($config['enabled']) {
$index = 0;
foreach ($config['proxy_urls'] as $path => $proxyUrl) {
$abstractDefinition = $container->getDefinition('phpmentors_proxy_url_rewrite.proxy_url');
$definition = new Definition();
$definition->setClass($abstractDefinition->getClass());
$definition->setFactoryService($abstractDefinition->getFactoryService());
$definition->setFactoryMethod($abstractDefinition->getFactoryMethod());
$definition->setAbstract(false);
$definition = new DefinitionDecorator('phpmentors_proxy_url_rewrite.proxy_url');
$definition->setArguments(array($path, $proxyUrl));

$serviceId = 'phpmentors_proxy_url_rewrite.proxy_url'.$index;
Expand Down
4 changes: 3 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
</call>
</service>
<service id="phpmentors_proxy_url_rewrite.proxy_asset_extension" class="%phpmentors_proxy_url_rewrite.proxy_asset_extension.class%" public="false"/>
<service id="phpmentors_proxy_url_rewrite.proxy_url" class="%phpmentors_proxy_url_rewrite.proxy_url.class%" factory-service="phpmentors_proxy_url_rewrite.proxy_url_factory" factory-method="create" abstract="true"/>
<service id="phpmentors_proxy_url_rewrite.proxy_url" class="%phpmentors_proxy_url_rewrite.proxy_url.class%" abstract="true">
<factory service="phpmentors_proxy_url_rewrite.proxy_url_factory" method="create"/>
</service>
<service id="phpmentors_proxy_url_rewrite.proxy_url_collection" class="%phpmentors_proxy_url_rewrite.proxy_url_collection.class%"/>
<service id="phpmentors_proxy_url_rewrite.proxy_url_factory" class="%phpmentors_proxy_url_rewrite.proxy_url_factory.class%"/>
<service id="phpmentors_proxy_url_rewrite.proxy_url_rewrite_listener" class="%phpmentors_proxy_url_rewrite.proxy_url_rewrite_listener.class%">
Expand Down

0 comments on commit 9567a2b

Please sign in to comment.