Implement the backend structure to support read and write operations on the ce_event_edit_association table.
This includes:
- A storage/service class (named something like EventEditAssociationStore may under a new folder called something like EventEditAssociation) responsible for database access:
- Encapsulates all SQL logic
- Provides methods to insert and retrieve data
- Should handle validation, error handling, and pagination TDB
- A data object class (named something like EventEditAssociation) that represents a single row in the ce_event_edit_association table:
- Defines all relevant properties with proper types: TDB
- event ID
- revision ID
- user ID
- bytes added
- bytes removed
- characters added
- characters removed
- edit timestamp
- Includes corresponding getters and setters
- Can include optional validation logic
- Defines all relevant properties with proper types: TDB
The object class should be used:
- As input to the insert method
- As the return type from data retrieval methods
Recommended method examples in the storage class:
- insertAssociation( EventEditAssociation $entity )
- getEventEditSummary( int $eventId ): array
- getEventEditList( int $eventId, int $limit, int $offset ): EventEditAssociation[]
BDD
gherkin
Feature: Provide structured data access to ce_event_edit_association records
Scenario: Insert a new association record
Given an instance of a class like EventEditAssociation with valid data
When insertAssociation is called
Then a new row is inserted into ce_event_edit_association
Scenario: Fetch summary metrics for an event
Given an event ID is provided
When getEventEditSummary is called
Then it returns an array with:
| total users |
| total bytes added |
| total bytes removed |
| total characters added |
| total characters removed |
Scenario: Fetch summary metrics for an event with no data
Given an event ID is provided
And the event has no associated edits
When getEventEditSummary is called
Then it returns an array with all values set to 0
Scenario: Fetch paginated list of associated edits with data
Given the event ID, offset, and limit
And the event has associated edits
When getEventEditList is called
Then it returns a list of instances of the EventEditAssociation-like class
Scenario: Fetch paginated list of associated edits with no data
Given the event ID, offset, and limit
And the event has no associated edits
When getEventEditList is called
Then it returns an empty list