Creating the database schema

Doctrine is smart enough to generate the database schema corresponding to the entity mapping information.

Note

It's a good practice to always design entities first and to generate the related database schema after that.

To do this, we will again use Command-Line Tools installed in the first chapter. Type this command in the root directory of our project:

  php vendor/bin/doctrine.php orm:schema-tool:create

The following text must be printed in the terminal:

ATTENTION: This operation should not be executed in a production environment.

Creating database schema...

Database schema created successfully!

A new table called Post has been created in the database. You can use the SQLite client to show the structure of the generated ...

Get Persistence in PHP with Doctrine ORM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.