Skip to content

Commit 4403ef2

Browse files
committed
bug #1253 Add ResetInterface to LiveComponentMetadataFactory (TheDutchScorpion)
This PR was squashed before being merged into the 2.x branch. Discussion ---------- Add ResetInterface to LiveComponentMetadataFactory | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Issues | N/A | License | MIT This PR is a follow-up to the already merged PR #1251 Commits ------- 8d3d328e77 Add ResetInterface to LiveComponentMetadataFactory
2 parents b7cc449 + 539e3cb commit 4403ef2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/DependencyInjection/LiveComponentExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ function (ChildDefinition $definition, AsLiveComponent $attribute) {
184184
new Reference('ux.twig_component.component_factory'),
185185
new Reference('property_info'),
186186
])
187+
->addTag('kernel.reset', ['method' => 'reset'])
187188
;
188189

189190
$container->register(ComponentValidator::class)

src/Metadata/LiveComponentMetadataFactory.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
1515
use Symfony\Component\PropertyInfo\Type;
16+
use Symfony\Contracts\Service\ResetInterface;
1617
use Symfony\UX\LiveComponent\Attribute\LiveProp;
1718
use Symfony\UX\TwigComponent\ComponentFactory;
1819

@@ -23,7 +24,7 @@
2324
*
2425
* @internal
2526
*/
26-
class LiveComponentMetadataFactory
27+
class LiveComponentMetadataFactory implements ResetInterface
2728
{
2829
/** @var LiveComponentMetadata[] */
2930
private array $liveComponentMetadata = [];
@@ -128,4 +129,9 @@ private static function propertiesFor(\ReflectionClass $class): iterable
128129
yield from self::propertiesFor($parent);
129130
}
130131
}
132+
133+
public function reset(): void
134+
{
135+
$this->liveComponentMetadata = [];
136+
}
131137
}

0 commit comments

Comments
 (0)