0% found this document useful (0 votes)
679 views

Commandes Symfony

This document provides instructions for generating common Symfony code elements like bundles, entities, databases, and CRUD functionality through Symfony console commands. It includes commands for generating bundles and entities, creating databases and tables, generating form types, installing assets, clearing caches, creating users, and generating CRUD controllers and templates for managing entities. It also provides tips for troubleshooting, like checking entity mappings, in case of issues.

Uploaded by

Saadi Badis
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
679 views

Commandes Symfony

This document provides instructions for generating common Symfony code elements like bundles, entities, databases, and CRUD functionality through Symfony console commands. It includes commands for generating bundles and entities, creating databases and tables, generating form types, installing assets, clearing caches, creating users, and generating CRUD controllers and templates for managing entities. It also provides tips for troubleshooting, like checking entity mappings, in case of issues.

Uploaded by

Saadi Badis
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Cration dun bundle :

phpapp/console generate:bundle

Gnration d'un entity:


phpapp/console generate:doctrine:entity

Gnration des entits :


phpapp/console doctrine:generate:entitiesNomduBundle:Nom de l'entity

Cration de la base de donne :


phpapp/console doctrine:database:create

Cration des tables :


phpapp/console doctrine:schema:create

Mettre jour les tables :


phpapp/console doctrine:schema:update --force

Gnration ducontructeur de formulaire(FormType):


phpapp/console doctrine:generate:formNomduBundle:Nom de l'entity

Mettre jour les CSS, JS et images :


phpapp/console assets:install

Vider le cache :
phpapp/console cache:clear

Cration dun utilisateur pour FOSUserBundle :


phpapp/console fos:user:create

Rendre un utilisateur admin :

phpapp/console fos:user:promoteusername
ROLE_ADMIN

En cas de problme, pour vrifier les entits :


php app/console cache:warmup --env=prod --no-debug

CRUD

C:\wamp\www\app_symfony2.8>php app/console doctrine:generate:crud

Welcome to the Doctrine2 CRUD generator

This command helps you generate CRUD controllers and templates.

First, give the name of the existing entity for which you want to generate a CRU
D
(use the shortcut notation like AcmeBlogBundle:Post)

The Entity shortcut name: filmBundle:film

By default, the generator creates two actions: list and show.


You can also ask it to generate "write" actions: new, update, and delete.

Do you want to generate the "write" actions [no]? yes

Determine the format to use for the generated CRUD.

Configuration format (yml, xml, php, or annotation) [annotation]: yml

Determine the routes prefix (all the routes will be "mounted" under this
prefix: /prefix/, /prefix/new, ...).

Routes prefix [/film]:

Summary before generation

You are going to generate a CRUD controller for "filmBundle:film"


using the "yml" format.

Do you confirm generation [yes]?

CRUD generation

Generating the CRUD code: OK


Generating the Form code: OK
Updating the routing: Confirm automatic update of the Routing [yes]?
Importing the CRUD routes:

[ERROR] The bundle's "Resources/config/routing.yml" file cannot be imported


from "app/config/routing.yml" because the "filmBundle" bundle is
already imported. Make sure you are not using two different
configuration/routing formats in the same bundle because it won't work.
OK

Everything is OK! Now get to work :).

C:\wamp\www\app_symfony2.8>

You might also like