ORM
Doctrine
Doctrine is the ORM used, you have at your disposal the entities in the folder app/src/Entity
and access to EntityManager
from the controllers with $this->em;
.
Here is the doctrine command that you will need to declare your entities in database (Make sure you have created your database beforehand):
Linux and MacOs
$ php vendor/bin/doctrine orm:schema-tool:update
Windows
$ php vendor/doctrine/orm/bin/doctrine.php orm:schema-tool:update
Beside your entities you have repository
, these are the classes where you will write the doctrine queries using for example its QueryBuilder.
For more info on the ORM, I invite you to go and see the documentation officiel.
Fixtures
You can send predefined database data with data-fixtures, create your fixtures in the app/src/Entity/DataFixtures
folder, and run the command :
$ php console data:fixtures
Attention, this command purges the database to then send all the fixtures of file app/src/Entity/DataFixtures
, to send a specific fixture without hollowing the base, to launch the command :
$ php console data:fixture <YourFixture>