Documentation

FeedRepositoryInterface

Repository interface for Feed entities.

This is a domain port defining the contract for feed persistence. Infrastructure implementations (e.g., MySqlFeedRepository) provide the actual database access.

Tags
since
3.0.0

Table of Contents

Methods

countFeeds()  : int
Count feeds with optional filtering.
delete()  : bool
Delete a feed by its ID.
deleteMultiple()  : int
Delete multiple feeds by IDs.
exists()  : bool
Check if a feed exists.
find()  : Feed|null
Find a feed by its ID.
findAll()  : array<string|int, Feed>
Find all feeds.
findByLanguage()  : array<string|int, Feed>
Find feeds by language ID.
findNeedingAutoUpdate()  : array<string|int, Feed>
Find feeds that need auto-update.
findPaginated()  : array<string|int, Feed>
Find feeds with pagination and filtering.
getForSelect()  : array<int, array{id: int, name: string, language_id: int}>
Get feeds formatted for select dropdown options.
save()  : int
Save a feed entity.
updateTimestamp()  : void
Update the last update timestamp for a feed.

Methods

countFeeds()

Count feeds with optional filtering.

public countFeeds([int|null $languageId = null ][, string|null $queryPattern = null ]) : int
Parameters
$languageId : int|null = null

Language ID filter (null for all)

$queryPattern : string|null = null

LIKE pattern for name filter

Return values
int

delete()

Delete a feed by its ID.

public delete(Feed|int $entityOrId) : bool
Parameters
$entityOrId : Feed|int

Feed entity or ID

Return values
bool

True if deleted, false if not found

deleteMultiple()

Delete multiple feeds by IDs.

public deleteMultiple(array<string|int, int> $ids) : int
Parameters
$ids : array<string|int, int>

Feed IDs

Return values
int

Number of feeds deleted

exists()

Check if a feed exists.

public exists(int $id) : bool
Parameters
$id : int

Feed ID

Return values
bool

find()

Find a feed by its ID.

public find(int $id) : Feed|null
Parameters
$id : int

Feed ID

Return values
Feed|null

The feed entity or null if not found

findAll()

Find all feeds.

public findAll([string $orderBy = 'NfUpdate' ][, string $direction = 'DESC' ]) : array<string|int, Feed>
Parameters
$orderBy : string = 'NfUpdate'

Column to order by (default: NfUpdate)

$direction : string = 'DESC'

Sort direction (ASC/DESC)

Return values
array<string|int, Feed>

findByLanguage()

Find feeds by language ID.

public findByLanguage(int $languageId[, string $orderBy = 'NfUpdate' ][, string $direction = 'DESC' ]) : array<string|int, Feed>
Parameters
$languageId : int

Language ID

$orderBy : string = 'NfUpdate'

Column to order by

$direction : string = 'DESC'

Sort direction

Return values
array<string|int, Feed>

findNeedingAutoUpdate()

Find feeds that need auto-update.

public findNeedingAutoUpdate(int $currentTime) : array<string|int, Feed>

Returns feeds where:

  • autoupdate option is set
  • current time > last update + interval
Parameters
$currentTime : int

Current Unix timestamp

Return values
array<string|int, Feed>

findPaginated()

Find feeds with pagination and filtering.

public findPaginated(int $offset, int $limit[, int|null $languageId = null ][, string|null $queryPattern = null ][, string $orderBy = 'NfUpdate' ][, string $direction = 'DESC' ]) : array<string|int, Feed>
Parameters
$offset : int

Pagination offset

$limit : int

Page size

$languageId : int|null = null

Language filter

$queryPattern : string|null = null

Name filter (LIKE pattern)

$orderBy : string = 'NfUpdate'

Column to order by

$direction : string = 'DESC'

Sort direction

Return values
array<string|int, Feed>

getForSelect()

Get feeds formatted for select dropdown options.

public getForSelect([int $languageId = 0 ][, int $maxNameLength = 40 ]) : array<int, array{id: int, name: string, language_id: int}>
Parameters
$languageId : int = 0

Language ID (0 for all languages)

$maxNameLength : int = 40

Maximum name length before truncation

Return values
array<int, array{id: int, name: string, language_id: int}>

save()

Save a feed entity.

public save(Feed|object $entity) : int

Inserts if new, updates if existing.

Parameters
$entity : Feed|object

The feed entity to save

Return values
int

The feed ID (newly generated for inserts)

updateTimestamp()

Update the last update timestamp for a feed.

public updateTimestamp(int $feedId, int $timestamp) : void
Parameters
$feedId : int

Feed ID

$timestamp : int

Unix timestamp


        
On this page

Search results