You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -65,3 +66,53 @@ Luckily Symfony tells you what to do !
65
66
> composer require form validator twig-bundle security-csrf annotations
66
67
67
68
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