Page 1 sur 1

generer en annotations au lieu d'attributs (Symfony 5.4 et PHP 8.2)

Posté : 25 avr. 2023, 11:30
par semsem
Bonjour y'a t-il la possibilité de changer les attributs qui génère automatiquement par symfony en annotations svp ?
Je change manuellement je perds du temps...

Auriez-vous une solution ou un tips merci :))

https://zupimages.net/up/23/17/2tpc.png

Re: generer en annotations au lieu d'attributs (Symfony 5.4 et PHP 8.2)

Posté : 25 avr. 2023, 12:09
par Saian
Salut, dans un cas basique logiquement dans config/packages/doctrine.yaml :
doctrine:
    # ...
    orm:
        # ...
        mappings:
            # ...
            SomeEntityNamespace: # usually AppBundle or App
                type: annotation
https://symfony.com/doc/5.3/reference/c ... .html#type

Re: generer en annotations au lieu d'attributs (Symfony 5.4 et PHP 8.2)

Posté : 25 avr. 2023, 14:23
par semsem

Re: generer en annotations au lieu d'attributs (Symfony 5.4 et PHP 8.2)

Posté : 25 avr. 2023, 14:48
par Saian
T'as pas bien regardé alors. Je vois bien orm / mappings / App dans ta capture. Y a juste à rajouter type: annotation.

D'ailleurs en symfony 5.4 c'est sensé être par défaut annotation.
https://symfony.com/doc/5.4/reference/c ... .html#type

Re: generer en annotations au lieu d'attributs (Symfony 5.4 et PHP 8.2)

Posté : 25 avr. 2023, 16:05
par semsem
Ohhhh super je croyais qu'il fallait que je remplace attributs par annotations, ça fonctionne !! Merci infiniment ;))