Skip to content

Commit

Permalink
Merge pull request #25 from matejvelikonja/patch-1
Browse files Browse the repository at this point in the history
SF 2.7 deprecation fix
  • Loading branch information
merk committed Jun 15, 2015
2 parents a6e8cf7 + ce1d41d commit 4f752c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions DependencyInjection/InfiniteFormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
Expand Down Expand Up @@ -47,5 +48,14 @@ public function load(array $configs, ContainerBuilder $container)
if ($configs['twig']) {
$loader->load('twig.xml');
}

$attachmentDefinition = $container->getDefinition('infinite_form.attachment.form_type');

if (method_exists($attachmentDefinition, 'setFactory')) {
$attachmentDefinition->setFactory(array(new Reference('doctrine'), 'getManager'));
} else {
$attachmentDefinition->setFactoryService('doctrine');
$attachmentDefinition->setFactoryMethod('getManager');
}
}
}
4 changes: 3 additions & 1 deletion Resources/config/attachment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
<service id="infinite_form.attachment.form_type" class="%infinite_form.attachment.attachment_type.class%">
<argument>%infinite_form.attachment.default_secret%</argument>
<argument type="service">
<service class="Doctrine\Common\Persistence\ObjectManager" factory-service="doctrine" factory-method="getManager" public="false">
<service class="Doctrine\Common\Persistence\ObjectManager" public="false">
<!-- Added in extension class -->
<!--<factory service="doctrine" method="getManager"/>-->
<argument>%infinite_form.attachment.entity_manager%</argument>
</service>
</argument>
Expand Down

0 comments on commit 4f752c0

Please sign in to comment.