Symfony Commands (Bundle / Entities / CRUD aus existierender Tabelle)

10.10.2013 | Symfony

1. Bundle erzeugen php app/console generate:bundle --namespace=Acme/eudb php app/console generate:bundle --namespace=Acme/EudbBundle  2. Tabelle importieren (3 Steps):2.1 Erzeugen der MetadatenTabelle

1. Bundle erzeugen


php app/console generate:bundle --namespace=Acme/eudb
php app/console generate:bundle --namespace=Acme/EudbBundle
 

2. Tabelle importieren (3 Steps):

2.1 Erzeugen der Metadaten

Tabellennamen müssen tatsächlich großgeschrieben werden!!!


php app/console doctrine:mapping:convert xml src/Acme/EudbBundle/Resources/config/doctrine/metadata/orm --from-database --filter="Categories"
php app/console doctrine:mapping:convert xml src/Acme/EudbBundle/Resources/config/doctrine/metadata/orm --from-database --filter="Content"
 

2.2 Importieren der Metadaten


php app/console doctrine:mapping:import AcmeEudbBundle annotation --filter="Categories"
php app/console doctrine:mapping:import AcmeEudbBundle annotation --filter="Content"
php app/console doctrine:mapping:import AcmeTyre24Bundle annotation
php app/console doctrine:mapping:import AcmeTyre24Bundle annotation --em=tyre24
 

2.3 Erzeugen der Entities (evtl. alle eines Bundles oder pro Tabelle)


php app/console doctrine:generate:entities AcmeEudbBundle
php app/console doctrine:generate:entities AcmeEudbBundle:Categories --no-backup
php app/console doctrine:generate:entities AcmeEudbBundle:Content --no-backup
php app/console doctrine:generate:entities AcmeEudbBundle --no-backup

 

3. CRUD Anwendung (Controller) generieren mit Annotations


php app/console doctrine:generate:crud --entity=AcmeEudbBundle:Categories --format=annotation --with-write --no-interaction
php app/console doctrine:generate:crud --entity=AcmeEudbBundle:Content --format=annotation --with-write --no-interaction
 

4. diverse Befehle


# alle Assets aus dem Bundle nach web exportieren:
php app/console assets:install

# Router debuggen: (console-output)
php app/console router:debug

# Version
php app/console version
 

sollte es nötig sein: cache/clear


php app/console cache:clear
php app/console cache:clear --env=dev
php app/console cache:clear --env=prod
php app/console doctrine:cache:clear-metadata
 

Analyse

Entwurf

Development

Launch