Skip to content

Define requirement to the twig bundle for UX Component and UX Live Components #569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/LiveComponent/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"php": ">=8.0",
"symfony/property-access": "^5.4|^6.0",
"symfony/serializer": "^5.4|^6.0",
"symfony/ux-twig-component": "^2.5"
"symfony/twig-bundle": "^5.4|^6.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think TwigBundle is not required here (nothing imported from TwigBundle in src only from twig).

Copy link
Contributor Author

@alexander-schranz alexander-schranz Dec 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the component it requires the specific service twig and so has a requirement to twig bundle itself. Because that is the bundle providing that service definition.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh do you think about this one?

->setArguments([new Reference('twig')]);

If, we add the bundle this can be removed

$bundles = $container->getParameter('kernel.bundles');
if (!isset($bundles['TwigBundle'])) {
return;
}

And there are other missing dependencies too, like dependency-injection, router, http-kernel, ... don't we should add those too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is what currently failing the installation inside a empty skeleton. I personally would if they are required, but not sure, wait what @weaverryan think about that.

"symfony/ux-twig-component": "^2.5",
"twig/twig": "^2.0|^3.0"
},
"require-dev": {
"doctrine/annotations": "^1.0",
Expand All @@ -40,7 +42,6 @@
"symfony/framework-bundle": "^5.4|^6.0",
"symfony/phpunit-bridge": "^6.0",
"symfony/security-csrf": "^5.4|^6.0",
"symfony/twig-bundle": "^5.4|^6.0",
"symfony/validator": "^5.4|^6.0",
"zenstruck/browser": "^1.2.0",
"zenstruck/foundry": "^1.10"
Expand Down
4 changes: 2 additions & 2 deletions src/TwigComponent/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
"symfony/dependency-injection": "^5.4|^6.0",
"symfony/event-dispatcher": "^5.4|^6.0",
"symfony/property-access": "^5.4|^6.0",
"symfony/twig-bundle": "^5.4|^6.0",
"twig/twig": "^2.0|^3.0"
},
"require-dev": {
"symfony/framework-bundle": "^5.4|^6.0",
"symfony/phpunit-bridge": "^6.0",
"symfony/twig-bundle": "^5.4|^6.0"
"symfony/phpunit-bridge": "^6.0"
},
"conflict": {
"symfony/config": "<5.4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
Expand All @@ -38,10 +37,6 @@ final class TwigComponentExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container): void
{
if (!isset($container->getParameter('kernel.bundles')['TwigBundle'])) {
throw new LogicException('The TwigBundle is not registered in your application. Try running "composer require symfony/twig-bundle".');
}

$container->registerAttributeForAutoconfiguration(
AsTwigComponent::class,
static function (ChildDefinition $definition, AsTwigComponent $attribute) {
Expand Down