# APIV3 Notes ## Mapping and Model ### Mapping (Doctrine) - Autogenerated by command (Attention to doctrine.yml -> schema_filter) - We adapt if already exists - French names by default (from DB) - We rename fields and filenames to english follow conventions. ### Model - Autogenerated by command - We adapt if already exists - In the context of API-Platform entities are considered models ## Resources - Representation of data that can be queried, created, updated, or deleted via RESTful API endpoints. - We copy existing and adapt - OpenAPI language - To configure routes/http-operations ## Filters - We copy existing and adapt - To customize sorting/filtering - Used by Resources ## Serialization - We copy existing and adapt - To customize responses (read) - To customize incoming data from parameters (write) - Used by Resources ## Controllers - We copy existing and adapt - To customize resource operations - To interact with services - Used by Resources ## Services - We copy existing and adapt - To group logic into reusable methods - Used by Controllers ## Interfaces - We copy existing and adapt - To interact with third-party libraries - To interact with Repositories - Used by Services ## Repositories - We copy existing and adapt - To interact with Doctrine and perform DB operations. - Used by Interfaces (Mandatory) ## Examples ### Simple scenario - No filters or special serialization needed - No controller needed - No services, interfaces or repositories needed ``` Resource -> Model -> Mapping -> DB ``` ### Complex scenario - We can optionally add filters, serialization, custom controller, use multiple services, interfaces and repositories. ``` Resource -> Filters -> Serialization -> Controller -> Service/s -> Interface/s -> Repositories -> DB ```