Unverified Commit 56286c5e authored by j1mb0b's avatar j1mb0b Committed by e0ipso

Issue #3045087 by j1mb0b, bander2, e0ipso, sonnykt, psf_, igarbla, Wim Leers,...

Issue #3045087 by j1mb0b, bander2, e0ipso, sonnykt, psf_, igarbla, Wim Leers, jungle, esolitos, christian.marx, jncruces, markcarver: Fatal error with impostor normalizers when there is an autowired service
parent c1d24b91
......@@ -41,7 +41,20 @@ class JsonapiExtrasServiceProvider extends ServiceProviderBase {
// \Drupal\jsonapi\Serializer\Serializer::__construct().
$container_namespaces = $container->getParameter('container.namespaces');
$container_modules = $container->getParameter('container.modules');
$container_namespaces['Drupal\jsonapi\Normalizer\ImpostorFrom\jsonapi_extras'][] = dirname($container_modules['jsonapi_extras']['pathname']) . '/src-impostor-normalizers';
$jsonapi_impostor_path = dirname($container_modules['jsonapi_extras']['pathname']) . '/src-impostor-normalizers';
$container_namespaces['Drupal\jsonapi\Normalizer\ImpostorFrom\jsonapi_extras'][] = $jsonapi_impostor_path;
// Manually include the impostor definitions to avoid class not found error
// during compilation, which gets triggered though cache-clear.
$container->getDefinition('serializer.normalizer.field_item.jsonapi_extras')
->setFile($jsonapi_impostor_path . '/FieldItemNormalizerImpostor.php');
$container->getDefinition('serializer.normalizer.resource_identifier.jsonapi_extras')
->setFile($jsonapi_impostor_path . '/ResourceIdentifierNormalizerImpostor.php');
$container->getDefinition('serializer.normalizer.resource_object.jsonapi_extras')
->setFile($jsonapi_impostor_path . '/ResourceObjectNormalizerImpostor.php');
$container->getDefinition('serializer.normalizer.content_entity.jsonapi_extras')
->setFile($jsonapi_impostor_path . '/ContentEntityDenormalizerImpostor.php');
$container->getDefinition('serializer.normalizer.config_entity.jsonapi_extras')
->setFile($jsonapi_impostor_path . '/ConfigEntityDenormalizerImpostor.php');
$container->setParameter('container.namespaces', $container_namespaces);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment