Converting fos package service to yml
I have a FosUserBundle service that I need to convert to yml format. How can I do this, is there a dump truck converter or something else?
How would it look in yml?
<service id="fos_user.mailer.twig_swift" class="FOS\UserBundle\Mailer\TwigSwiftMailer" public="false">
<argument type="service" id="mailer" />
<argument type="service" id="router" />
<argument type="service" id="twig" />
<argument type="collection">
<argument key="template" type="collection">
<argument key="confirmation">%fos_user.registration.confirmation.template%</argument>
<argument key="resetting">%fos_user.resetting.email.template%</argument>
</argument>
<argument key="from_email" type="collection">
<argument key="confirmation">%fos_user.registration.confirmation.from_email%</argument>
<argument key="resetting">%fos_user.resetting.email.from_email%</argument>
</argument>
</argument>
</service>
I tried to use Yum dumper, but that just gives me a serialized object:
$cs = new ContainerBuilder();
$loader1 = new Loader\XmlFileLoader($cs, new FileLocator(__DIR__ . '/../../../../vendor/friendsofsymfony/user-bundle/FOS/UserBundle/Resources/config'));
$loader1->load('mailer.xml');
$dumper = new \Symfony\Component\Yaml\Dumper();
file_put_contents(__DIR__ . '/test2.yml', $dumper->dump($cs));
Any advice would be much appreciated. Thanks in advance.
+3
source to share
1 answer
You can try doing it this way:
services:
fos_user.mailer.twig_swift:
class: FOS\UserBundle\Mailer\TwigSwiftMailer
arguments:
- @mailer
- @router
- @templating
- { template: { confirmation: %fos_user.registration.confirmation.template%, resetting: %fos_user.resetting.email.template% }, from_email: { confirmation: %fos_user.registration.confirmation.from_email%, resetting: %fos_user.resetting.email.from_email% } }
You are using the wrong dump truck and you must use Symfony\Component\DependencyInjection\Dumper\YamlDumper
+7
source to share