Documentation

MySqlActivityRepository implements ActivityRepositoryInterface

MySQL implementation of ActivityRepositoryInterface.

Uses INSERT ... ON DUPLICATE KEY UPDATE for atomic counter upserts.

Tags
since
3.0.0

Table of Contents

Interfaces

ActivityRepositoryInterface
Repository interface for daily activity tracking.

Methods

getActiveDatesDescending()  : array<int, string>
Get all dates with any activity, ordered most recent first.
getActivityForDateRange()  : array<int, array{date: string, terms_created: int, terms_reviewed: int, texts_read: int}>
Get activity data for a date range.
getTodaySummary()  : array{terms_created: int, terms_reviewed: int, texts_read: int}
Get today's activity summary.
incrementTermsCreated()  : void
Increment the terms-created counter for today.
incrementTermsReviewed()  : void
Increment the terms-reviewed counter for today.
incrementTextsRead()  : void
Increment the texts-read counter for today.
incrementColumn()  : void
Atomically increment a column for today's row.

Methods

getActiveDatesDescending()

Get all dates with any activity, ordered most recent first.

public getActiveDatesDescending() : array<int, string>
Return values
array<int, string>

Dates in Y-m-d format

getActivityForDateRange()

Get activity data for a date range.

public getActivityForDateRange(string $startDate, string $endDate) : array<int, array{date: string, terms_created: int, terms_reviewed: int, texts_read: int}>
Parameters
$startDate : string

Start date (Y-m-d)

$endDate : string

End date (Y-m-d)

Return values
array<int, array{date: string, terms_created: int, terms_reviewed: int, texts_read: int}>

getTodaySummary()

Get today's activity summary.

public getTodaySummary() : array{terms_created: int, terms_reviewed: int, texts_read: int}
Return values
array{terms_created: int, terms_reviewed: int, texts_read: int}

incrementTermsCreated()

Increment the terms-created counter for today.

public incrementTermsCreated([int $count = 1 ]) : void
Parameters
$count : int = 1

Number to add (default 1)

incrementTermsReviewed()

Increment the terms-reviewed counter for today.

public incrementTermsReviewed([int $count = 1 ]) : void
Parameters
$count : int = 1

Number to add (default 1)

incrementTextsRead()

Increment the texts-read counter for today.

public incrementTextsRead([int $count = 1 ]) : void
Parameters
$count : int = 1

Number to add (default 1)

incrementColumn()

Atomically increment a column for today's row.

private incrementColumn(string $column, int $count) : void

Uses INSERT ... ON DUPLICATE KEY UPDATE for upsert.

Parameters
$column : string

Column name to increment

$count : int

Amount to add


        
On this page

Search results