Introduction

Welcome on this demo application. It tries to show how to use Symfony4+ php web application framework in a modern ways. It covers different usage: simple controller, call to external API, twig usage for more classic (old school ;-)) usage, and almost real SPA with REST or GraphQL API.
So, for the most complex samples, i used the following db model. Usually tutorial will only use a classic Book vs Review models. So it doesn't cover more complex ManyToMany relations with specific properties in the join tables. My model tries to be more complex. It will certainly not cover everything, but it may helps you to understand some complex parts.
You can participate on the github repository !
Database model
DB model

Here is the model used for this demo. There is differents relations type:

  • Books -> Serie: OnoToMany
  • Books -> Reviews: OnoToMany
  • Books -> Authors: ManyToMany throught ProjectBookCreation join table that contains extra fields (so it's OneToMany between Book and ProjectBookCreation, and OneToMany between Editors and ProjectBookCreation
  • Books -> Editors: same as Authors but with ProjectBookEdition
  • Books -> Tags: ManyToMany auto managed with Doctrine

Extra informations

Api Platform usage

Except Tags entity, all mapping is done throught Doctrine Entities. It benefits of all native extensions from ApiPlatform like Pagination, Sorting, and all others Filtering systems.
Tags entity is managed with DataProvider and DataPersister which is the recommenced pattern from [official documentation](https://api-platform.com/docs/core/design/). With Tags, the aim is to show how to use finely DataProvider and DataPersister with extensions systems (this is a Work In Progress).