Skip to content

Commit

Permalink
Do not try to generate fragments for generated fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Nov 23, 2020
1 parent 4d0bdba commit cc5d72c
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -83,6 +83,14 @@ protected function registerFragments(ContainerBuilder $container, string $tag):
$command = $container->hasDefinition('contao.command.debug_fragments') ? $container->findDefinition('contao.command.debug_fragments') : null;

foreach ($this->findAndSortTaggedServices($tag, $container) as $reference) {
// If a controller has multiple methods for different fragment type (e.g. a content element
// and a front end module), the first RegisterFragmentsPass creates a child definition that
// inherits all tags from the original. On the next run, the RegisterFragmentsPass would
// pick up the child definition and try to create duplicate fragments.
if (0 === strpos((string) $reference, 'contao.fragment._')) {
continue;
}

$definition = $container->findDefinition($reference);

$tags = $definition->getTag($tag);
Expand Down

0 comments on commit cc5d72c

Please sign in to comment.