Skip to content

Commit 7a5f2f4

Browse files
author
letitbe133
committed
Updated .md && .env files
1 parent 9f0a0ce commit 7a5f2f4

File tree

2 files changed

+59
-8
lines changed

2 files changed

+59
-8
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ APP_SECRET=7d1e5704ae7e8a2174e5ca48b104abf1
2424
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
2525
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
2626
# Configure your db driver and server_version in config/packages/doctrine.yaml
27-
DATABASE_URL=mysql://letitbe133:Tinjiful@127.0.0.1:3306/symfony_api
27+
DATABASE_URL=mysql://DB_USERNAME:DB_PASSWORD@127.0.0.1:3306/DB_NAME
2828
###< doctrine/doctrine-bundle ###

initialisation.md

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
> composer create-project symfony/skeleton project_name
88
>
9-
> **using Symfony CLI**
9+
> **using Symfony CLI** (optionnal)
10+
1011
> symfony new --version=skeleton project_name
1112
1213
## Initialize Git
@@ -21,19 +22,19 @@
2122
2223
## All commands to be executed
2324

24-
<!-- if CLI installed -->
25+
**without Symfony CLI**
2526

26-
> symfony console { command }
27+
> php bin/console { command }
2728
28-
<!-- no CLI -->
29+
**using Symfony CLI** (optionnal)
2930

30-
> php bin/console { command }
31+
> symfony console { command }
3132
3233
# Let's get started !
3334

3435
## create a brand new database
3536

36-
> symfony console doctrine:database:create db_name
37+
> php bin/console doctrine:database:create db_name
3738
3839
What happens ?
3940

@@ -55,7 +56,7 @@ See ?
5556

5657
Unleash the power of Symfony !
5758

58-
> symfony console doctrine:make:crud
59+
> php bin/console make:crud
5960
6061
What happens and what should we do next ?
6162
Luckily Symfony tells you what to do !
@@ -65,3 +66,53 @@ Luckily Symfony tells you what to do !
6566
> composer require form validator twig-bundle security-csrf annotations
6667
6768
That should do the trick
69+
70+
## how about populating our database ?
71+
72+
How do we create a table ? We could use **MySql CLI** or maybe **phpmyadmin**.
73+
74+
But Symfony provides a handy tool for that :
75+
76+
> php bin/console make:entity
77+
78+
Now you just have to answer the wizard's questions to get things done
79+
80+
Go take a look at your database. Still empty, right ?
81+
82+
Now take a look at your **/src/Entity ** folder. Great no ?
83+
84+
## we still have to populate our databse
85+
86+
Let's do that !
87+
88+
> php bin/console make:migration
89+
90+
Now you just created a migration but it was not executed. Check your database, nothing's changed.
91+
92+
Let's migrate NOW !
93+
94+
> php bin/console doctrine:migrations:migrate
95+
96+
Check your database, now you should have a brand new table with the correct fields
97+
98+
Now have a look at your **/src/Migrations** folder : inside you should have a migration file. Have a look and you'll see you have some SQL request inside
99+
100+
## have a break, have a KitKat !
101+
102+
So far we :
103+
104+
- created a Symfony project
105+
- configured our database connexion
106+
- created our database
107+
- created a table
108+
- migrated it to the database
109+
110+
Now we should start working on building our API
111+
112+
## welcome to Hogwarts
113+
114+
**Spoil alert** : Some magical stuff ahead
115+
116+
> php bin/console make:crud
117+
118+
On what **entity** the CRUD should be performed ? Since we have only one, it should be **Project**

0 commit comments

Comments
 (0)