Creating Entity Relationships
This is where things get a little more interesting as far as our entities are concerned because the Reservation entity will be what holds everything together and connects a Passenger to a Flight.
But we need to think about the way in which they all related to each other. I decided upon these rules:
- One flight can have many reservations
- One reservation can be for only one flight
- One passenger can have many reservations
- One reservation can be for only one passenger - (I know this can be different in real life so we could consider linking reservations).
We need to consider these rules when creating the entity relationships.
Branch: https://github.com/GaryClarke/php-api-pro/tree/45-reservations-entity
4 comments