J'essaie de créer une application Web avec Symfony et j'ai besoin d'un côté administrateur. Mais cela ne fonctionne pas et je ne vois aucune réponse à mon problème sur aucun site. Nous y voilà :

J'ai ce problème à chaque fois que j'essaye de lier un CRUD dans mon menu :

An exception has been thrown during the rendering of a template ("Unable to find the controller related to the "App\Controller\Admin\Producteur" Entity; did you forget to extend "EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController"?").
Et si je le lis attentivement, j'ai oublié une extension dans l'un des fichiers mais je ne vois pas où. De plus, je génère ces fichiers avec le bundle et j'ai cette erreur juste après cela et d'autres personnes qui font le même protocole que moi n'ont pas cette erreur.

Je vous ai donné mes différents fichiers si vous voyez quelque chose, car je ne peux pas être bloqué et ne pas terminer mon stage.

Producteur.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
 
namespace App\Entity;
 
use App\Repository\ProducteurRepository;
use Doctrine\ORM\Mapping as ORM;
 
/**
 * @ORM\Entity(repositoryClass=ProducteurRepository::class)
 */
class Producteur
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue
     * @ORM\Column(type="integer")
     */
    private $id;
 
    /**
     * @ORM\OneToOne(targetEntity=PtManufacturer::class, cascade={"persist", "remove"})
     * @ORM\JoinColumn(nullable=false, name="id_manufacturer", referencedColumnName="id_manufacturer")
     */
    private $Nom;
 
    /**
     * @ORM\Column(type="string", length=255)
     */
    private $courriel_User;
 
    /**
     * @ORM\Column(type="string", length=255)
     */
    private $courriel_Corresp;
 
    /**
     * @ORM\Column(type="boolean")
     */
    private $TVA_Appl;
 
    /**
     * @ORM\Column(type="string", length=20)
     */
    private $Num_TVA;
 
    /**
     * @ORM\Column(type="text")
     */
    private $Pied_De_Doc;
 
    /**
     * @ORM\Column(type="string", length=255)
     */
    private $adresse1_E;
 
    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $adresse2_E;
 
    /**
     * @ORM\Column(type="string", length=5)
     */
    private $CP_E;
 
    /**
     * @ORM\Column(type="string", length=100)
     */
    private $Ville_E;
 
    /**
     * @ORM\Column(type="string", length=255)
     */
    private $adresse1_F;
 
    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $adresse2_F;
 
    /**
     * @ORM\Column(type="string", length=5)
     */
    private $CP_F;
 
    /**
     * @ORM\Column(type="string", length=100)
     */
    private $Ville_F;
 
    /**
     * @ORM\Column(type="string", length=50)
     */
    private $Num_Tel;
 
    public function getId(): ?int
    {
        return $this->id;
    }
 
    public function getNom(): ?PtManufacturer
    {
        return $this->Nom;
    }
 
    public function setNom(PtManufacturer $Nom): self
    {
        $this->Nom = $Nom;
 
        return $this;
    }
 
    public function getCourrielUser(): ?string
    {
        return $this->courriel_User;
    }
 
    public function setCourrielUser(string $courriel_User): self
    {
        $this->courriel_User = $courriel_User;
 
        return $this;
    }
 
    public function getCourrielCorresp(): ?string
    {
        return $this->courriel_Corresp;
    }
 
    public function setCourrielCorresp(string $courriel_Corresp): self
    {
        $this->courriel_Corresp = $courriel_Corresp;
 
        return $this;
    }
 
    public function getTVAAppl(): ?bool
    {
        return $this->TVA_Appl;
    }
 
    public function setTVAAppl(bool $TVA_Appl): self
    {
        $this->TVA_Appl = $TVA_Appl;
 
        return $this;
    }
 
    public function getNumTVA(): ?string
    {
        return $this->Num_TVA;
    }
 
    public function setNumTVA(string $Num_TVA): self
    {
        $this->Num_TVA = $Num_TVA;
 
        return $this;
    }
 
    public function getPiedDeDoc(): ?string
    {
        return $this->Pied_De_Doc;
    }
 
    public function setPiedDeDoc(string $Pied_De_Doc): self
    {
        $this->Pied_De_Doc = $Pied_De_Doc;
 
        return $this;
    }
 
    public function getAdresse1E(): ?string
    {
        return $this->adresse1_E;
    }
 
    public function setAdresse1E(string $adresse1_E): self
    {
        $this->adresse1_E = $adresse1_E;
 
        return $this;
    }
 
    public function getAdresse2E(): ?string
    {
        return $this->adresse2_E;
    }
 
    public function setAdresse2E(?string $adresse2_E): self
    {
        $this->adresse2_E = $adresse2_E;
 
        return $this;
    }
 
    public function getCPE(): ?string
    {
        return $this->CP_E;
    }
 
    public function setCPE(string $CP_E): self
    {
        $this->CP_E = $CP_E;
 
        return $this;
    }
 
    public function getVilleE(): ?string
    {
        return $this->Ville_E;
    }
 
    public function setVilleE(string $Ville_E): self
    {
        $this->Ville_E = $Ville_E;
 
        return $this;
    }
 
    public function getAdresse1F(): ?string
    {
        return $this->adresse1_F;
    }
 
    public function setAdresse1F(string $adresse1_F): self
    {
        $this->adresse1_F = $adresse1_F;
 
        return $this;
    }
 
    public function getAdresse2F(): ?string
    {
        return $this->adresse2_F;
    }
 
    public function setAdresse2F(?string $adresse2_F): self
    {
        $this->adresse2_F = $adresse2_F;
 
        return $this;
    }
 
    public function getCPF(): ?string
    {
        return $this->CP_F;
    }
 
    public function setCPF(string $CP_F): self
    {
        $this->CP_F = $CP_F;
 
        return $this;
    }
 
    public function getVilleF(): ?string
    {
        return $this->Ville_F;
    }
 
    public function setVilleF(string $Ville_F): self
    {
        $this->Ville_F = $Ville_F;
 
        return $this;
    }
 
    public function getNumTel(): ?string
    {
        return $this->Num_Tel;
    }
 
    public function setNumTel(string $Num_Tel): self
    {
        $this->Num_Tel = $Num_Tel;
 
        return $this;
    }
}
ProducteurCrudController.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 
namespace App\Controller\Admin;
 
use App\Entity\Producteur;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
 
class ProducteurCrudController extends AbstractCrudController
{
    public static function getEntityFqcn(): string
    {
        return Producteur::class;
    }
 
    /*
    public function configureFields(string $pageName): iterable
    {
        return [
            IdField::new('id'),
            TextField::new('title'),
            TextEditorField::new('description'),
        ];
    }
    */
}
DashboardController.php

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
namespace App\Controller\Admin;
 
use EasyCorp\Bundle\EasyAdminBundle\Config\Dashboard;
use EasyCorp\Bundle\EasyAdminBundle\Config\MenuItem;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractDashboardController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
 
class DashboardController extends AbstractDashboardController
{
    /**
     * @Route("/admin", name="admin")
     */
    public function index(): Response
    {
        return parent::index();
    }
 
    public function configureDashboard(): Dashboard
    {
        return Dashboard::new()
            ->setTitle('Backoffice');
    }
 
    public function configureMenuItems(): iterable
    {
        return[
            MenuItem::linktoDashboard('Dashboard', 'fa fa-home'),
            MenuItem::linkToCrud('Producteur', 'fas fa-list', Producteur::class),
        ];
    }
}
menu.html.twig
Code twig : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
{% macro render_menu_item(item) %}
    {% if item.isMenuSection %}
        {% if item.icon is not empty %}<i class="menu-icon fa-fw {{ item.icon }}"></i>{% endif %}
        <span class="{{ item.cssClass }}">{{ item.label }}</span>
    {% else %}
        <a href="{{ item.linkUrl }}" class="{{ item.cssClass }}" target="{{ item.linkTarget }}" rel="{{ item.linkRel }}" referrerpolicy="origin-when-cross-origin">
            {% if item.icon is not empty %}<i class="menu-icon fa-fw {{ item.icon }}"></i>{% endif %}
            <span>{{ item.label|raw }}</span>
            {% if item.hasSubItems %}<i class="fa fa-fw fa-angle-right treeview-icon"></i>{% endif %}
        </a>
    {% endif %}
{% endmacro %}
 
{% block main_menu_before %}{% endblock %}
 
<ul class="sidebar-menu" data-widget="tree" data-animation-speed="250">
    {% block main_menu %}
        {% for menuItem in ea.mainMenu.items %}
            {% block menu_item %}
                <li class="{{ menuItem.isMenuSection ? 'header' }} {{ menuItem.hasSubItems ? 'treeview' }} {{ ea.mainMenu.isSelected(menuItem) ? 'active' }} {{ ea.mainMenu.isExpanded(menuItem) ? 'active submenu-active' }}">
                    {{ _self.render_menu_item(menuItem) }}
 
                    {% if menuItem.hasSubItems %}
                        <ul class="treeview-menu">
                            {% for menuSubItem in menuItem.subItems %}
                                {% block menu_subitem %}
                                    <li class="{{ menuSubItem.isMenuSection ? 'header' }} {{ ea.mainMenu.isSelected(menuSubItem) ? 'active' }}">
                                        {{ _self.render_menu_item(menuSubItem) }}
                                    </li>
                                {% endblock menu_subitem %}
                            {% endfor %}
                        </ul>
                    {% endif %}
                </li>
            {% endblock menu_item %}
        {% endfor %}
    {% endblock main_menu %}
</ul>
 
{% block main_menu_after %}{% endblock %}

Merci d'avance pour votre aide.