@@ -11,8 +11,8 @@ to familiarize yourself in the `TwigComponent documentation`_.
1111
1212A 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
110110Suppose 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
200200Let'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.
10641064First, add a method with a ``LiveAction `` attribute above it that does
10651065the 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
11401140This 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
11921192In your component, to allow each argument to be passed, add
11931193the ``#[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
12331233page). You can do that by returning a ``RedirectResponse `` from your
12341234action::
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
13031303The 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
14261426package comes with a special trait - ``ComponentWithFormTrait `` - to
14271427make 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
25242524If 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
31423142Let's look at a full, complex example of an embedded component. Suppose
31433143you 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
31693169And 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;
0 commit comments