/** * {@inheritdoc} */ public function process(ContainerBuilder $container) { if (!$container->hasDefinition($this->registry) && !$container->hasAlias($this->registry)) { return; } // $registry = $container->findDefinition($this->registry); foreach ($container->findTaggedServiceIds($this->tag) as $id => $tags) { /** * Note: The class is registered here directly instead of using $registry->addMethodCall() * because then it is not ensured that types are set before the JMSSerializerBundle processes * the listeners and thus, the type would not be registered at all. */ EnumHandler::register($container->getDefinition($id)->getClass()); } }
/** * {@inheritDoc} */ public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); if (isset($config['serializer']['types']) && is_array($config['serializer']['types'])) { foreach ($config['serializer']['types'] as $enumClass) { /** * Note: The class is registered here directly instead of using $registry->addMethodCall() * because then it is not ensured that types are set before the JMSSerializerBundle processes * the listeners and thus, the type would not be registered at all. */ EnumHandler::register($enumClass); } $loader->load('handler.xml'); } }
public static function provideSupportedFormats() { return [EnumHandler::getSupportedFormats()]; }