B
B
BonBon Slick2018-12-07 11:19:22
symfony
BonBon Slick, 2018-12-07 11:19:22

Load xml serializer in Kernel?

There are a lot of serializers, I would like to connect them in the kernel, I'm not using services, something like

/**
   * @param ContainerBuilder $container
   * @param LoaderInterface  $loader
   *
   * @throws \Exception
   */
  protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) : void {
    $container->setParameter('container.autowiring.strict_mode', true);
    $container->setParameter('container.dumper.inline_class_loader', true);
    $confDir = $this->getProjectDir() . '/config';
    $loader->load($confDir . '/packages/*' . self::CONFIG_EXTS, 'glob');
    if (is_dir($confDir . '/packages/' . $this->environment)) {
      $loader->load($confDir . '/packages/' . $this->environment . '/**/*' . self::CONFIG_EXTS, 'glob');
    }
    $loader->load($confDir . '/services' . self::CONFIG_EXTS, 'glob');
    $loader->load($confDir . '/services_' . $this->environment . self::CONFIG_EXTS, 'glob');
    // Custom section
    $container->loadFromExtension(
      'doctrine',
      [
        'orm' => [
          'mappings' => $this->getNestedEntityMappingFiles(),
        ],
      ]
    );

The doc doesn't cover this, for XML it doesn't even say how to include a serializer in a service if it's not an annotation.
https://symfony.com/doc/current/serializer.html
https://symfony.com/doc/current/components/seriali...
Let's say I have a folder
App\Serializer\User\User.Serializer.xml
App \Serializer\Video\Video.Serializer.xml
These files need to be loaded as loadFromExtension mappers are loaded, but I can't figure out how to do it correctly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2018-12-07
@BonBonSlick

https://symfony.com/doc/current/reference/configur...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question