Skip to content

Commit 286a0d9

Browse files
committed
bug #819 [Translator] Prefix bundle and extension classes with "Ux" (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- [Translator] Prefix bundle and extension classes with "Ux" | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a short README for your feature/bugfix. This will help people understand your PR and can be used as a start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Never break backward compatibility (see https://symfony.com/bc). - Features and deprecations must be submitted against branch main. --> While installing the package for the demo page, I've got the following issue: > There is no extension able to load the configuration for "ux_translator" (in "/Users/kocal/workspace-os/symfony-ux/ux.symfony.com/config/packages/ux_translator.yaml"). Looked for namespace "ux_ translator", found ""framework", "twig", "twig_extra", "webpack_encore", "turbo", "mercure", "web_profiler", "monolog", "debug", "twig_component", "live_component", "chartjs", "cropperjs", "laz y_image", "dropzone", "doctrine", "doctrine_migrations", "maker", "babdev_pagerfanta", "autocomplete", "notify", "react", "vue", "svelte", "translator"" in /Users/kocal/workspace-os/symfony-ux/ ux.symfony.com/config/packages/ux_translator.yaml (which is being imported from "/Users/kocal/workspace-os/symfony-ux/ux.symfony.com/src/Kernel.php"). <img width="1789" alt="image" src="https://user-images.githubusercontent.com/2103975/234497995-550ce874-8445-4dcf-a9bf-5368797be699.png"> (you can also see it in the recipe PR symfony/recipes#1185) Indeed, I've used `ux_translator` for the `TreeBuilder`'s name and not `translator` (to prevent misundersting with Symfony's Translator PHP version), but the related Bundle and Extension classes were not named correctly. After the fix, the bundle is correctly loaded: <img width="1486" alt="image" src="https://user-images.githubusercontent.com/2103975/234498103-f791c0e8-0da2-4867-a3cd-65018774cee4.png"> Commits ------- fb19c14 [Translator] Prefix bundle and extension classes with "Ux"
2 parents 4b3aa8d + fb19c14 commit 286a0d9

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/Translator/src/DependencyInjection/TranslatorExtension.php renamed to src/Translator/src/DependencyInjection/UxTranslatorExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @experimental
2525
*/
26-
class TranslatorExtension extends Extension
26+
class UxTranslatorExtension extends Extension
2727
{
2828
public function load(array $configs, ContainerBuilder $container)
2929
{

src/Translator/src/TranslatorBundle.php renamed to src/Translator/src/UxTranslatorBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @experimental
2222
*/
23-
class TranslatorBundle extends Bundle
23+
class UxTranslatorBundle extends Bundle
2424
{
2525
public function getPath(): string
2626
{

src/Translator/tests/Kernel/EmptyAppKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Symfony\Component\Config\Loader\LoaderInterface;
1515
use Symfony\Component\HttpKernel\Kernel;
16-
use Symfony\UX\Translator\TranslatorBundle;
16+
use Symfony\UX\Translator\UxTranslatorBundle;
1717

1818
/**
1919
* @author Hugo Alliaume <[email protected]>
@@ -26,7 +26,7 @@ class EmptyAppKernel extends Kernel
2626

2727
public function registerBundles(): iterable
2828
{
29-
return [new TranslatorBundle()];
29+
return [new UxTranslatorBundle()];
3030
}
3131

3232
public function registerContainerConfiguration(LoaderInterface $loader)

src/Translator/tests/Kernel/FrameworkAppKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Config\Loader\LoaderInterface;
1616
use Symfony\Component\DependencyInjection\ContainerBuilder;
1717
use Symfony\Component\HttpKernel\Kernel;
18-
use Symfony\UX\Translator\TranslatorBundle;
18+
use Symfony\UX\Translator\UxTranslatorBundle;
1919

2020
/**
2121
* @author Hugo Alliaume <[email protected]>
@@ -28,7 +28,7 @@ class FrameworkAppKernel extends Kernel
2828

2929
public function registerBundles(): iterable
3030
{
31-
return [new FrameworkBundle(), new TranslatorBundle()];
31+
return [new FrameworkBundle(), new UxTranslatorBundle()];
3232
}
3333

3434
public function registerContainerConfiguration(LoaderInterface $loader)

src/Translator/tests/TranslatorBundleTest.php renamed to src/Translator/tests/UxTranslatorBundleTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Symfony\UX\Translator\Tests\Kernel\EmptyAppKernel;
88
use Symfony\UX\Translator\Tests\Kernel\FrameworkAppKernel;
99

10-
class TranslatorBundleTest extends TestCase
10+
class UxTranslatorBundleTest extends TestCase
1111
{
1212
public function provideKernels()
1313
{
@@ -21,6 +21,6 @@ public function provideKernels()
2121
public function testBootKernel(Kernel $kernel)
2222
{
2323
$kernel->boot();
24-
$this->assertArrayHasKey('TranslatorBundle', $kernel->getBundles());
24+
$this->assertArrayHasKey('UxTranslatorBundle', $kernel->getBundles());
2525
}
2626
}

0 commit comments

Comments
 (0)