Documentation

ArticleRepositoryInterface

Repository interface for Article entities (feed_links).

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

Tags
since
3.0.0

Table of Contents

Methods

countByFeed()  : int
Count articles by feed ID.
countByFeeds()  : int
Count articles by multiple feed IDs.
delete()  : bool
Delete an article by its ID or entity.
deleteByFeed()  : int
Delete all articles for a feed.
deleteByFeeds()  : int
Delete all articles for multiple feeds.
deleteByIds()  : int
Delete articles by IDs.
find()  : Article|null
Find an article by its ID.
findByFeed()  : array<string|int, Article>
Find articles by feed ID with pagination.
findByFeedsWithStatus()  : array<string|int, Article, text_id: int|null, archived_id: int|null, status: string}>
Find articles by feed IDs with status information.
findByIds()  : array<string|int, Article>
Find articles by multiple IDs.
getCountPerFeed()  : array<int, int>
Get article count per feed.
insertBatch()  : array{inserted: int, duplicates: int}
Insert multiple articles in batch.
markAsError()  : void
Mark an article as error by its link.
resetErrorsByFeeds()  : int
Reset error status for articles in feeds.
save()  : int
Save an article entity.
titleExistsForFeed()  : bool
Check if an article with the given title exists for a feed.

Methods

countByFeed()

Count articles by feed ID.

public countByFeed(int $feedId[, string $search = '' ]) : int
Parameters
$feedId : int

Feed ID

$search : string = ''

Search query for title/description

Return values
int

countByFeeds()

Count articles by multiple feed IDs.

public countByFeeds(array<string|int, int> $feedIds[, string $search = '' ]) : int
Parameters
$feedIds : array<string|int, int>

Feed IDs

$search : string = ''

Search query for title/description

Return values
int

delete()

Delete an article by its ID or entity.

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

Article entity or ID

Return values
bool

True if deleted, false if not found

deleteByFeed()

Delete all articles for a feed.

public deleteByFeed(int $feedId) : int
Parameters
$feedId : int

Feed ID

Return values
int

Number of deleted articles

deleteByFeeds()

Delete all articles for multiple feeds.

public deleteByFeeds(array<string|int, int> $feedIds) : int
Parameters
$feedIds : array<string|int, int>

Feed IDs

Return values
int

Number of deleted articles

deleteByIds()

Delete articles by IDs.

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

Article IDs

Return values
int

Number of deleted articles

findByFeed()

Find articles by feed ID with pagination.

public findByFeed(int $feedId[, int $offset = 0 ][, int $limit = 50 ][, string $orderBy = 'FlDate' ][, string $direction = 'DESC' ]) : array<string|int, Article>
Parameters
$feedId : int

Feed ID

$offset : int = 0

Pagination offset

$limit : int = 50

Page size

$orderBy : string = 'FlDate'

Column to order by

$direction : string = 'DESC'

Sort direction

Return values
array<string|int, Article>

findByFeedsWithStatus()

Find articles by feed IDs with status information.

public findByFeedsWithStatus(array<string|int, int> $feedIds[, int $offset = 0 ][, int $limit = 50 ][, string $orderBy = 'FlDate' ][, string $direction = 'DESC' ][, string $search = '' ]) : array<string|int, Article, text_id: int|null, archived_id: int|null, status: string}>

Returns articles with additional status info from texts/archived_texts tables.

Parameters
$feedIds : array<string|int, int>

Feed IDs

$offset : int = 0

Pagination offset

$limit : int = 50

Page size

$orderBy : string = 'FlDate'

Column to order by

$direction : string = 'DESC'

Sort direction

$search : string = ''

Search query for title/description

Return values
array<string|int, Article, text_id: int|null, archived_id: int|null, status: string}>

findByIds()

Find articles by multiple IDs.

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

Article IDs

Return values
array<string|int, Article>

getCountPerFeed()

Get article count per feed.

public getCountPerFeed([array<string|int, int> $feedIds = [] ]) : array<int, int>
Parameters
$feedIds : array<string|int, int> = []

Feed IDs (empty for all feeds)

Return values
array<int, int>

Map of feed ID to article count

insertBatch()

Insert multiple articles in batch.

public insertBatch(array<string|int, Article$articles, int $feedId) : array{inserted: int, duplicates: int}

Ignores duplicates based on (FlNfID, FlTitle) unique key.

Parameters
$articles : array<string|int, Article>

Articles to insert

$feedId : int

Feed ID for all articles

Return values
array{inserted: int, duplicates: int}

markAsError()

Mark an article as error by its link.

public markAsError(string $link) : void

Adds a leading space to the link to mark it as unloadable.

Parameters
$link : string

Article link

resetErrorsByFeeds()

Reset error status for articles in feeds.

public resetErrorsByFeeds(array<string|int, int> $feedIds) : int

Removes the leading space from article links that were marked as errors.

Parameters
$feedIds : array<string|int, int>

Feed IDs

Return values
int

Number of reset articles

save()

Save an article entity.

public save(Article|object $entity) : int

Inserts if new, updates if existing.

Parameters
$entity : Article|object

The article entity to save

Return values
int

The article ID (newly generated for inserts)

titleExistsForFeed()

Check if an article with the given title exists for a feed.

public titleExistsForFeed(int $feedId, string $title) : bool
Parameters
$feedId : int

Feed ID

$title : string

Article title

Return values
bool

        
On this page

Search results