From b7d44354ec8389d66bc211052f9e747e67342ca3 Mon Sep 17 00:00:00 2001 From: Nick Yeoman Date: Wed, 16 Nov 2022 12:43:07 -0800 Subject: [PATCH] added documentation and fixed some composer packages --- bash/newProject.bash | 2 +- docs/Controller.md | 11 +++++++++++ docs/console.md | 0 docs/database.md | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 docs/Controller.md create mode 100644 docs/console.md create mode 100644 docs/database.md diff --git a/bash/newProject.bash b/bash/newProject.bash index 655d819..5d22d8d 100644 --- a/bash/newProject.bash +++ b/bash/newProject.bash @@ -79,7 +79,7 @@ composer req annotations # Dev components composer req --dev maker -composer req --dev profiler +composer req --dev symfony/profiler-pack composer req debug logger ################################################################################ diff --git a/docs/Controller.md b/docs/Controller.md new file mode 100644 index 0000000..6321199 --- /dev/null +++ b/docs/Controller.md @@ -0,0 +1,11 @@ +# Controllers + +## Create a Controller + +```bash +symfony console make:controller controllerName +``` + +You don't need to add Controller to the end of the name, make will do that automatically. +Find your files in src/Controller + diff --git a/docs/console.md b/docs/console.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/database.md b/docs/database.md new file mode 100644 index 0000000..7fd7cbb --- /dev/null +++ b/docs/database.md @@ -0,0 +1,37 @@ +# Working with symfony database + +## Setting up a Database table + +### Part 1 - Entity Class + +```bash +php bin/console make:entity +``` +And then follow the instructions. + +This will create a entity class in src/Entity + +**Note: ** You can run make:entity again with the same Entity name to add more fields. +You will have to ehn drun make:migration and then doctrine:migrations:migrate + +The system is smart enough not to duplicate work. + +## Part 2 - Create Migration + +To create a migration from the entity, run: + +```bash +php bin/console make:migration +``` + +A file will be created in the migrations folder. + +## Part 3 - Create the table (run migration) + +```bash +php bin/console doctrine:migrations:migrate +``` + +## References + +* [Symfony doctrine](https://symfony.com/doc/current/doctrine.html) \ No newline at end of file