- Composer
- PHP 7.4
- Symfony
- PostgreSQL server
composer install- Set up environment variables in
.envfile - bothDATABASE_URLandPOSTGRES_DSNcan point to the same database php bin/console doctrine:database:createphp bin/console doctrine:migrations:migratephp bin/console create:event-streamsymfony serve
Event sourcing for the Partner entity.
Current state of Partner entity is stored in partner table.
There are five events related to Partner entity:
PartnerWasCreatedPartnerNameChangedPartnerDescriptionChangedPartnerNipChangedPartnerWebpageChanged
Each event stores the timestamp of its occurence, and the data that changed on the Partner entity plus the metadata
Events for entity are stored in the database table with the name generated by the prooph.
The name of this table can be looked up in the event_streams table. When more entities would be added, name of the table storing events for the new entity would also be stored in event_streams table
| Method | URL | Description | Request body |
|---|---|---|---|
| POST | localhost:8000/partner | Create new partner | { |
| PUT | localhost:8000/partner/{partner-uuid} | Update partner with uuid = partner-uuid | { |
| GET | localhost:8000/partner | Get a list of all partners | |
| GET | localhost:8000/events/partner/{partner-uuid} | Get events for the partner with uuid = partner-uuid |
Serialization of Partner entity includes empty array of recorded events even if there already are events for the entity