Skip to content

Commit 4f3452f

Browse files
committed
[make:entity] use ux-turbo instead of ux-turbo-mercure
1 parent 415332d commit 4f3452f

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
mercure:
3+
image: dunglas/mercure
4+
environment:
5+
SERVER_NAME: :1337
6+
MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
7+
MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
8+
MERCURE_EXTRA_DIRECTIVES: |
9+
anonymous
10+
cors_origins *
11+
ports:
12+
- 1337:1337

src/Maker/MakeEntity.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Bundle\MakerBundle\Doctrine\EntityRegenerator;
2121
use Symfony\Bundle\MakerBundle\Doctrine\EntityRelation;
2222
use Symfony\Bundle\MakerBundle\Doctrine\ORMDependencyBuilder;
23+
use Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException;
2324
use Symfony\Bundle\MakerBundle\FileManager;
2425
use Symfony\Bundle\MakerBundle\Generator;
2526
use Symfony\Bundle\MakerBundle\InputAwareMakerInterface;
@@ -31,6 +32,7 @@
3132
use Symfony\Bundle\MakerBundle\Util\CliOutputHelper;
3233
use Symfony\Bundle\MakerBundle\Util\PhpCompatUtil;
3334
use Symfony\Bundle\MakerBundle\Validator;
35+
use Symfony\Bundle\MercureBundle\DependencyInjection\MercureExtension;
3436
use Symfony\Component\Console\Command\Command;
3537
use Symfony\Component\Console\Input\InputArgument;
3638
use Symfony\Component\Console\Input\InputInterface;
@@ -149,6 +151,11 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
149151
&& class_exists(Broadcast::class)
150152
&& !class_exists($this->generator->createClassNameDetails($entityClassName, 'Entity\\')->getFullName())
151153
) {
154+
// Mercure is needed
155+
if (!class_exists(MercureExtension::class)) {
156+
throw new RuntimeCommandException('Please run "composer require symfony/mercure". It is needed to broadcast entities.');
157+
}
158+
152159
$description = $command->getDefinition()->getOption('broadcast')->getDescription();
153160
$question = new ConfirmationQuestion($description, false);
154161
$isBroadcast = $io->askQuestion($question);
@@ -321,7 +328,7 @@ public function configureDependencies(DependencyBuilder $dependencies, ?InputInt
321328
if (null !== $input && $input->getOption('broadcast')) {
322329
$dependencies->addClassDependency(
323330
Broadcast::class,
324-
'ux-turbo-mercure'
331+
'ux-turbo'
325332
);
326333
}
327334

tests/Maker/MakeEntityTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,12 @@ private function createMakeEntityTestForMercure(): MakerTestDetails
4444
;
4545
}
4646

47-
// @legacy - MakeEntity uses ux-turbo-mercure (archived), it needs to use ux-turbo (mercure built in) for Symfony 7.0
48-
if ('7.0.x-dev' === $_SERVER['SYMFONY_VERSION']) {
49-
return $this->createMakerTest()
50-
->skipTest('symfony/ux-turbo-mercure is not supported on Symfony 7.')
51-
;
52-
}
53-
5447
return $this->createMakeEntityTest()
5548
->preRun(function (MakerTestRunner $runner) {
5649
// installed manually later so that the compatibility check can run first
57-
$runner->runProcess('composer require symfony/ux-turbo-mercure');
50+
$runner->runProcess('composer require symfony/ux-turbo');
5851
})
52+
->addExtraDependencies('mercure', 'twig')
5953
;
6054
}
6155

0 commit comments

Comments
 (0)