Skip to content

Commit a97bb54

Browse files
committed
Use singular folder pattern like other PHP components codes
1 parent d4c48be commit a97bb54

36 files changed

+75
-75
lines changed

src/LiveComponent/doc/index.rst

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ to familiarize yourself in the `TwigComponent documentation`_.
1111

1212
A real-time product search component might look like this::
1313

14-
// src/Twig/Components/ProductSearch.php
15-
namespace App\Twig\Components;
14+
// src/Twig/Component/ProductSearch.php
15+
namespace App\Twig\Component;
1616

1717
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
1818
use Symfony\UX\LiveComponent\Attribute\LiveProp;
@@ -109,8 +109,8 @@ documentation to get the basics of Twig components.
109109

110110
Suppose you've already built a basic Twig component::
111111

112-
// src/Twig/Components/RandomNumber.php
113-
namespace App\Twig\Components;
112+
// src/Twig/Component/RandomNumber.php
113+
namespace App\Twig\Component;
114114

115115
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
116116

@@ -137,7 +137,7 @@ re-rendered live on the frontend), replace the component's
137137

138138
.. code-block:: diff
139139
140-
// src/Twig/Components/RandomNumber.php
140+
// src/Twig/Component/RandomNumber.php
141141
- use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
142142
+ use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
143143
+ use Symfony\UX\LiveComponent\DefaultActionTrait;
@@ -199,8 +199,8 @@ LiveProps: Stateful Component Properties
199199

200200
Let's make our component more flexible by adding a ``$max`` property::
201201

202-
// src/Twig/Components/RandomNumber.php
203-
namespace App\Twig\Components;
202+
// src/Twig/Component/RandomNumber.php
203+
namespace App\Twig\Component;
204204

205205
// ...
206206
use Symfony\UX\LiveComponent\Attribute\LiveProp;
@@ -299,7 +299,7 @@ Well, actually, we're missing one step. By default, a ``LiveProp`` is
299299

300300
.. code-block:: diff
301301
302-
// src/Twig/Components/RandomNumber.php
302+
// src/Twig/Component/RandomNumber.php
303303
// ...
304304
305305
class RandomNumber
@@ -1064,8 +1064,8 @@ that, when clicked, sets the min/max numbers back to a default value.
10641064
First, add a method with a ``LiveAction`` attribute above it that does
10651065
the work::
10661066

1067-
// src/Twig/Components/RandomNumber.php
1068-
namespace App\Twig\Components;
1067+
// src/Twig/Component/RandomNumber.php
1068+
namespace App\Twig\Component;
10691069

10701070
// ...
10711071
use Symfony\UX\LiveComponent\Attribute\LiveAction;
@@ -1139,8 +1139,8 @@ normal controller method that you would create with a route.
11391139

11401140
This means that, for example, you can use action autowiring::
11411141

1142-
// src/Twig/Components/RandomNumber.php
1143-
namespace App\Twig\Components;
1142+
// src/Twig/Component/RandomNumber.php
1143+
namespace App\Twig\Component;
11441144

11451145
// ...
11461146
use Psr\Log\LoggerInterface;
@@ -1192,8 +1192,8 @@ You can also pass arguments to your action by adding each as a
11921192
In your component, to allow each argument to be passed, add
11931193
the ``#[LiveArg]`` attribute::
11941194

1195-
// src/Twig/Components/ItemList.php
1196-
namespace App\Twig\Components;
1195+
// src/Twig/Component/ItemList.php
1196+
namespace App\Twig\Component;
11971197

11981198
// ...
11991199
use Psr\Log\LoggerInterface;
@@ -1233,8 +1233,8 @@ Sometimes, you may want to redirect after an action is executed
12331233
page). You can do that by returning a ``RedirectResponse`` from your
12341234
action::
12351235

1236-
// src/Twig/Components/RandomNumber.php
1237-
namespace App\Twig\Components;
1236+
// src/Twig/Component/RandomNumber.php
1237+
namespace App\Twig\Component;
12381238

12391239
// ...
12401240
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -1302,8 +1302,8 @@ You can also specify a modifier parameter to choose which files should be upload
13021302

13031303
The files will be available in a regular ``$request->files`` files bag::
13041304

1305-
// src/Twig/Components/FileUpload.php
1306-
namespace App\Twig\Components;
1305+
// src/Twig/Component/FileUpload.php
1306+
namespace App\Twig\Component;
13071307

13081308
use Symfony\Component\HttpFoundation\Request;
13091309
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
@@ -1426,7 +1426,7 @@ Ok: time to build that ``PostForm`` component! The Live Components
14261426
package comes with a special trait - ``ComponentWithFormTrait`` - to
14271427
make it easy to deal with forms::
14281428

1429-
namespace App\Twig\Components;
1429+
namespace App\Twig\Component;
14301430

14311431
use App\Entity\Post;
14321432
use App\Form\PostType;
@@ -2523,8 +2523,8 @@ Changing the URL when a LiveProp changes
25232523

25242524
If you want the URL to update when a ``LiveProp`` changes, you can do that with the ``url`` option::
25252525

2526-
// src/Twig/Components/SearchModule.php
2527-
namespace App\Twig\Components;
2526+
// src/Twig/Component/SearchModule.php
2527+
namespace App\Twig\Component;
25282528

25292529
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
25302530
use Symfony\UX\LiveComponent\Attribute\LiveProp;
@@ -3142,7 +3142,7 @@ Full Embedded Component Example
31423142
Let's look at a full, complex example of an embedded component. Suppose
31433143
you have an ``EditPost``::
31443144

3145-
namespace App\Twig\Components;
3145+
namespace App\Twig\Component;
31463146

31473147
use App\Entity\Post;
31483148
use Doctrine\ORM\EntityManagerInterface;
@@ -3168,7 +3168,7 @@ you have an ``EditPost``::
31683168

31693169
And a ``MarkdownTextarea``::
31703170

3171-
namespace App\Twig\Components;
3171+
namespace App\Twig\Component;
31723172

31733173
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
31743174
use Symfony\UX\LiveComponent\Attribute\LiveProp;
@@ -3596,7 +3596,7 @@ Then specify this new route on your component:
35963596

35973597
.. code-block:: diff
35983598
3599-
// src/Twig/Components/RandomNumber.php
3599+
// src/Twig/Component/RandomNumber.php
36003600
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
36013601
use Symfony\UX\LiveComponent\DefaultActionTrait;
36023602
@@ -3615,7 +3615,7 @@ You can also control the type of the generated URL:
36153615

36163616
.. code-block:: diff
36173617
3618-
// src/Twig/Components/RandomNumber.php
3618+
// src/Twig/Component/RandomNumber.php
36193619
+ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
36203620
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
36213621
use Symfony\UX\LiveComponent\DefaultActionTrait;

src/Map/doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ and implement the method ``instantiateMap`` to return a ``Map`` instance.
586586

587587
You can interact with the Map by using ``LiveAction`` attribute::
588588

589-
namespace App\Twig\Components;
589+
namespace App\Twig\Component;
590590

591591
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
592592
use Symfony\UX\LiveComponent\Attribute\LiveAction;

src/TwigComponent/doc/index.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ making it easier to render and re-use small template "units" - like an
77

88
Every component consists of (1) a class::
99

10-
// src/Twig/Components/Alert.php
11-
namespace App\Twig\Components;
10+
// src/Twig/Component/Alert.php
11+
namespace App\Twig\Component;
1212

1313
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
1414

@@ -79,8 +79,8 @@ Let's create a reusable "alert" element that we can use to show success
7979
or error messages across our site. Step 1 is to create a component class
8080
and give it the ``AsTwigComponent`` attribute::
8181

82-
// src/Twig/Components/Alert.php
83-
namespace App\Twig\Components;
82+
// src/Twig/Component/Alert.php
83+
namespace App\Twig\Component;
8484

8585
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
8686

@@ -166,7 +166,7 @@ public property for each:
166166

167167
.. code-block:: diff
168168
169-
// src/Twig/Components/Alert.php
169+
// src/Twig/Component/Alert.php
170170
// ...
171171
172172
#[AsTwigComponent]
@@ -265,7 +265,7 @@ You can control the template used via the ``AsTwigComponent`` attribute:
265265

266266
.. code-block:: diff
267267
268-
// src/Twig/Components/Alert.php
268+
// src/Twig/Component/Alert.php
269269
// ...
270270
271271
- #[AsTwigComponent]
@@ -396,8 +396,8 @@ How? Components are *services*, which means autowiring works like
396396
normal. This example assumes you have a ``Product`` Doctrine entity and
397397
``ProductRepository``::
398398

399-
// src/Twig/Components/FeaturedProducts.php
400-
namespace App\Twig\Components;
399+
// src/Twig/Component/FeaturedProducts.php
400+
namespace App\Twig\Component;
401401

402402
use App\Repository\ProductRepository;
403403
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
@@ -457,7 +457,7 @@ The mount() Method
457457
For more control over how your "props" are handled, you can create a method
458458
called ``mount()``::
459459

460-
// src/Twig/Components/Alert.php
460+
// src/Twig/Component/Alert.php
461461
// ...
462462

463463
#[AsTwigComponent]
@@ -497,7 +497,7 @@ PreMount Hook
497497
If you need to modify/validate data before it's *mounted* on the
498498
component use a ``PreMount`` hook::
499499

500-
// src/Twig/Components/Alert.php
500+
// src/Twig/Component/Alert.php
501501
use Symfony\Component\OptionsResolver\OptionsResolver;
502502
use Symfony\UX\TwigComponent\Attribute\PreMount;
503503
// ...
@@ -557,7 +557,7 @@ PostMount Hook
557557
After a component is instantiated and its data mounted, you can run extra
558558
code via the ``PostMount`` hook::
559559

560-
// src/Twig/Components/Alert.php
560+
// src/Twig/Component/Alert.php
561561
use Symfony\UX\TwigComponent\Attribute\PostMount;
562562
// ...
563563

@@ -580,7 +580,7 @@ will contain any props passed to the component that have *not* yet been processe
580580
``mount()`` method). You can handle these props, remove them from the ``$data``
581581
and return the array::
582582

583-
// src/Twig/Components/Alert.php
583+
// src/Twig/Component/Alert.php
584584
#[AsTwigComponent]
585585
class Alert
586586
{

ux.symfony.com/src/Twig/Components/Alert.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace App\Twig\Components;
12+
namespace App\Twig\Component;
1313

1414
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
1515

ux.symfony.com/src/Twig/Components/BootstrapModal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace App\Twig\Components;
12+
namespace App\Twig\Component;
1313

1414
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
1515

ux.symfony.com/src/Twig/Components/ChangelogItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace App\Twig\Components;
12+
namespace App\Twig\Component;
1313

1414
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
1515

ux.symfony.com/src/Twig/Components/DinoChart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace App\Twig\Components;
12+
namespace App\Twig\Component;
1313

1414
use App\Service\DinoStatsService;
1515
use Symfony\UX\Chartjs\Builder\ChartBuilderInterface;

ux.symfony.com/src/Twig/Components/DocsLink.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace App\Twig\Components;
12+
namespace App\Twig\Component;
1313

1414
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;
1515
use Symfony\UX\TwigComponent\Attribute\ExposeInTemplate;

ux.symfony.com/src/Twig/Components/FoodVote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace App\Twig\Components;
12+
namespace App\Twig\Component;
1313

1414
use App\Entity\Food;
1515
use App\Repository\FoodRepository;

ux.symfony.com/src/Twig/Components/HomepageTerminalSwapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace App\Twig\Components;
12+
namespace App\Twig\Component;
1313

1414
use App\Model\UxPackage;
1515
use App\Service\UxPackageRepository;

0 commit comments

Comments
 (0)