Skip to content

Commit

Permalink
destruct properties
Browse files Browse the repository at this point in the history
  • Loading branch information
matheo committed Jul 20, 2023
1 parent 82d9a9f commit b19c71a
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 1 deletion.
Empty file.
8 changes: 8 additions & 0 deletions src/TwigComponent/doc/.idea/doc.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/TwigComponent/doc/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions src/TwigComponent/doc/.idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/TwigComponent/doc/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions src/TwigComponent/doc/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/TwigComponent/src/ComponentRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ private function exposedVariables(object $component, bool $exposePublicProps): \
/** @var ExposeInTemplate $attribute */
$value = $attribute->getter ? $component->{rtrim($attribute->getter, '()')}() : $this->propertyAccessor->getValue($component, $property->name);

if ($attribute->destruct) {
foreach ($value as $key => $destructedValue) {
yield $key => $destructedValue;
}
}

yield $attribute->name ?? $property->name => $value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Symfony\UX\TwigComponent\ComponentRendererInterface;
use Symfony\UX\TwigComponent\ComponentStack;
use Symfony\UX\TwigComponent\ComponentTemplateFinder;
use Symfony\UX\TwigComponent\ComponentTemplateFinderInterface;
use Symfony\UX\TwigComponent\DependencyInjection\Compiler\TwigComponentPass;
use Symfony\UX\TwigComponent\Twig\ComponentExtension;
use Symfony\UX\TwigComponent\Twig\ComponentLexer;
Expand Down

0 comments on commit b19c71a

Please sign in to comment.