Page MenuHomePhabricator

Create storage class for ce_event_edit_association data access
Closed, ResolvedPublic

Description

NOTE: This work has dependency on database work.

Implement the backend structure to support read and write operations on the ce_event_edit_association table.

This includes:

  1. 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
  1. 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

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

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptJul 29 2025, 3:24 PM
ifried renamed this task from Draft: Create storage class for ce_event_edit_association data access to Create storage class for ce_event_edit_association data access.Aug 18 2025, 7:22 PM
ifried updated the task description. (Show Details)
ifried changed the task status from Open to In Progress.Aug 21 2025, 4:18 PM
ifried assigned this task to cmelo.

Change #1181019 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] T400725: Add AssociateEditToEventStore class for database communication

https://gerrit.wikimedia.org/r/1181019

Change #1181019 had a related patch set uploaded (by Cmelo; author: Cmelo):

[mediawiki/extensions/CampaignEvents@master] Add AssociateEditToEventStore class for database communication

https://gerrit.wikimedia.org/r/1181019

Change #1181019 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Introduce DB layer EventContributionStore

https://gerrit.wikimedia.org/r/1181019

Note for: @vaughnwalters, this is not testable.

Okay thanks for the heads up @cmelo. I'll send this to product sign off then.