Documentation

FeedFacade

Facade providing backward-compatible interface to Feed module.

This facade wraps the use cases and services to provide a similar interface to the original FeedService for gradual migration.

Tags
since
3.0.0

Table of Contents

Properties

$articleExtractor  : ArticleExtractor
$articleRepository  : ArticleRepositoryInterface
$createFeed  : CreateFeed
$deleteArticles  : DeleteArticles
$deleteFeeds  : DeleteFeeds
$feedRepository  : FeedRepositoryInterface
$getArticles  : GetArticles
$getFeedById  : GetFeedById
$getFeedList  : GetFeedList
$importArticles  : ImportArticles
$loadFeed  : LoadFeed
$resetErrorArticles  : ResetErrorArticles
$rssParser  : RssParser
$textCreation  : TextCreationInterface
$updateFeed  : UpdateFeed

Methods

__construct()  : mixed
Constructor.
archiveOldTexts()  : array{archived: int, sentences: int, textitems: int}
Archive old texts with a specific tag.
buildQueryFilter()  : array{clause: string, search: string, mode: string, regex: string}
Build query filter condition for feed links.
countFeedLinks()  : int
Count feed links for specified feeds.
countFeeds()  : int
Count news_feeds with optional language and query filter.
createFeed()  : int
Create a new feed.
createTextFromFeed()  : int
Create a text from feed link data.
deleteArticles()  : int
Delete all articles for specified feeds.
deleteFeeds()  : array{feeds: int, articles: int}
Delete feeds by ID(s).
detectAndParseFeed()  : array<int|string, array<string, string>|string>|false
Detect and parse feed, determining best text source.
extractTextFromArticle()  : array<int|string, array<string, mixed>>
Extract text content from RSS feed article links.
formatLastUpdate()  : string
Format last update time as human-readable string.
getFeedById()  : array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}|null
Get a single feed by ID.
getFeedLinks()  : array<string|int, mixed>
Get feed links (articles) for specified feeds.
getFeedLoadConfig()  : array{feeds: array, count: int}
Get feed load configuration for JavaScript.
getFeeds()  : array<int, array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}>
Get all news_feeds for a language (or all languages).
getFeedsNeedingAutoUpdate()  : array<string|int, mixed>
Get feeds that need auto-update.
getLanguages()  : array<string|int, mixed>
Get all languages for select dropdown.
getLastUpdateData()  : array{value: int, unit: string}|null
Calculate last update time components.
getMarkedFeedLinks()  : array<int, array{FlID: int|null, FlNfID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, FlText: string, NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}>
Get marked feed links for processing.
getNfOption()  : string|array<string|int, mixed>|null
Get a specific option from the feed options string.
getSortColumn()  : string
Get the sort column for feeds/articles.
getSortOptions()  : array<string|int, mixed>
Get the sort options for feed/article lists.
importArticles()  : array<string|int, mixed>
Import articles as texts.
loadFeed()  : array<string|int, mixed>
Load/refresh a feed from its RSS source.
markLinkAsError()  : void
Mark feed link as having an error.
parseAutoUpdateInterval()  : int|null
Parse auto-update interval string to seconds.
parseRssFeed()  : array<string|int, mixed>|false
Parse RSS/Atom feed and return article links.
renderFeedLoadInterfaceModern()  : void
Render feed loading interface using Alpine.js component.
resetUnloadableArticles()  : int
Reset unloadable articles (remove leading space from links).
saveTextsFromFeed()  : array{textsArchived: int, sentencesDeleted: int, textItemsDeleted: int}
Save texts from feed wizard form data.
updateFeed()  : void
Update an existing feed.
validateRegexPattern()  : bool
Validate regex pattern for search.
articleEntityToArray()  : array{FlID: int|null, FlNfID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, FlText: string}
Convert Article entity to legacy array format.
articleToLegacyArray()  : array{FlID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, TxID: int|null, ArchivedTxID: int|null}
Convert article result to legacy array format.
feedToArray()  : array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}
Convert Feed entity to legacy array format.

Properties

Methods

__construct()

Constructor.

public __construct(FeedRepositoryInterface $feedRepository, ArticleRepositoryInterface $articleRepository, TextCreationInterface $textCreation, RssParser $rssParser, ArticleExtractor $articleExtractor) : mixed
Parameters
$feedRepository : FeedRepositoryInterface

Feed repository

$articleRepository : ArticleRepositoryInterface

Article repository

$textCreation : TextCreationInterface

Text creation adapter

$rssParser : RssParser

RSS parser

$articleExtractor : ArticleExtractor

Article extractor

archiveOldTexts()

Archive old texts with a specific tag.

public archiveOldTexts(string $tagName, int $maxTexts) : array{archived: int, sentences: int, textitems: int}
Parameters
$tagName : string

Tag name to filter

$maxTexts : int

Maximum texts to keep

Return values
array{archived: int, sentences: int, textitems: int}

buildQueryFilter()

Build query filter condition for feed links.

public buildQueryFilter(string $query, string $queryMode, string $regexMode) : array{clause: string, search: string, mode: string, regex: string}

Returns structured filter data for use with prepared statements. For backward compatibility, also returns a legacy SQL clause.

Parameters
$query : string

Search query

$queryMode : string

Query mode ('title', 'title,desc,text')

$regexMode : string

Regex mode ('' for LIKE, 'R' for RLIKE)

Return values
array{clause: string, search: string, mode: string, regex: string}

Filter data with clause for legacy use and search for prepared statements

Count feed links for specified feeds.

public countFeedLinks(string $feedIds[, string $search = '' ]) : int
Parameters
$feedIds : string

Comma-separated feed IDs

$search : string = ''

Search term (optional)

Return values
int

Number of matching feed links

countFeeds()

Count news_feeds with optional language and query filter.

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

Language ID filter (null for all)

$queryPattern : string|null = null

LIKE pattern for name filter

Return values
int

Number of matching feeds

createFeed()

Create a new feed.

public createFeed(array<string|int, mixed> $data) : int
Parameters
$data : array<string|int, mixed>

Feed data

Return values
int

New feed ID

createTextFromFeed()

Create a text from feed link data.

public createTextFromFeed(array<string|int, mixed> $textData, string $tagName) : int
Parameters
$textData : array<string|int, mixed>

Text data

$tagName : string

Tag name to apply

Return values
int

New text ID

deleteArticles()

Delete all articles for specified feeds.

public deleteArticles(string $feedIds) : int
Parameters
$feedIds : string

Comma-separated feed IDs

Return values
int

Number of deleted articles

deleteFeeds()

Delete feeds by ID(s).

public deleteFeeds(string $feedIds) : array{feeds: int, articles: int}
Parameters
$feedIds : string

Comma-separated feed IDs

Return values
array{feeds: int, articles: int}

Counts of deleted items

detectAndParseFeed()

Detect and parse feed, determining best text source.

public detectAndParseFeed(string $sourceUri) : array<int|string, array<string, string>|string>|false
Parameters
$sourceUri : string

Feed URL

Return values
array<int|string, array<string, string>|string>|false

Feed data or false on error

extractTextFromArticle()

Extract text content from RSS feed article links.

public extractTextFromArticle(array<int|string, array{link: string, title: string, audio?: string, text?: string}> $feedData, string $articleSection, string $filterTags[, string|null $charset = null ]) : array<int|string, array<string, mixed>>
Parameters
$feedData : array<int|string, array{link: string, title: string, audio?: string, text?: string}>

Array of feed items

$articleSection : string

XPath selector(s) for article content

$filterTags : string

XPath selector(s) for elements to remove

$charset : string|null = null

Override charset

Return values
array<int|string, array<string, mixed>>

Extracted text data

formatLastUpdate()

Format last update time as human-readable string.

public formatLastUpdate(int $diff) : string
Parameters
$diff : int

Time difference in seconds

Return values
string

Formatted string

getFeedById()

Get a single feed by ID.

public getFeedById(int $feedId) : array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}|null
Parameters
$feedId : int

Feed ID

Return values
array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}|null

Feed record or null if not found

Get feed links (articles) for specified feeds.

public getFeedLinks(string $feedIds[, string $search = '' ][, string $orderBy = 'FlDate DESC' ][, int $offset = 0 ][, int $limit = 50 ]) : array<string|int, mixed>
Parameters
$feedIds : string

Comma-separated feed IDs

$search : string = ''

Search term (optional)

$orderBy : string = 'FlDate DESC'

ORDER BY clause

$offset : int = 0

Pagination offset

$limit : int = 50

Pagination limit

Return values
array<string|int, mixed>

Array of feed link records

getFeedLoadConfig()

Get feed load configuration for JavaScript.

public getFeedLoadConfig(int $currentFeed, bool $checkAutoupdate) : array{feeds: array, count: int}
Parameters
$currentFeed : int

Feed ID to load

$checkAutoupdate : bool

Whether to check auto-update

Return values
array{feeds: array, count: int}

getFeeds()

Get all news_feeds for a language (or all languages).

public getFeeds([int|null $langId = null ]) : array<int, array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}>
Parameters
$langId : int|null = null

Language ID filter (null for all)

Return values
array<int, array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}>

Array of feed records

getFeedsNeedingAutoUpdate()

Get feeds that need auto-update.

public getFeedsNeedingAutoUpdate() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of feeds needing update

getLanguages()

Get all languages for select dropdown.

public getLanguages() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of language records

getLastUpdateData()

Calculate last update time components.

public getLastUpdateData(int $diff) : array{value: int, unit: string}|null
Parameters
$diff : int

Time difference in seconds

Return values
array{value: int, unit: string}|null

Returns time data or null if up to date

Get marked feed links for processing.

public getMarkedFeedLinks(array<string|int, mixed>|string $markedItems) : array<int, array{FlID: int|null, FlNfID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, FlText: string, NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}>
Parameters
$markedItems : array<string|int, mixed>|string

Array or comma-separated string of IDs

Return values
array<int, array{FlID: int|null, FlNfID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, FlText: string, NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}>

Array of feed link data with feed options

getNfOption()

Get a specific option from the feed options string.

public getNfOption(string $optionsStr, string $option) : string|array<string|int, mixed>|null
Parameters
$optionsStr : string

Options string

$option : string

Option name ('all' for array)

Return values
string|array<string|int, mixed>|null

Option value

getSortColumn()

Get the sort column for feeds/articles.

public getSortColumn(int $sortIndex[, string $prefix = 'Fl' ]) : string
Parameters
$sortIndex : int

Sort option index (1-3)

$prefix : string = 'Fl'

Column prefix

Return values
string

SQL ORDER BY column

getSortOptions()

Get the sort options for feed/article lists.

public getSortOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of sort option arrays

importArticles()

Import articles as texts.

public importArticles(array<string|int, int> $articleIds) : array<string|int, mixed>
Parameters
$articleIds : array<string|int, int>

Article IDs to import

Return values
array<string|int, mixed>

Import result

loadFeed()

Load/refresh a feed from its RSS source.

public loadFeed(int $feedId) : array<string|int, mixed>
Parameters
$feedId : int

Feed ID to load

Return values
array<string|int, mixed>

Load result

markLinkAsError()

Mark feed link as having an error.

public markLinkAsError(string $link) : void
Parameters
$link : string

Original link

parseAutoUpdateInterval()

Parse auto-update interval string to seconds.

public parseAutoUpdateInterval(string $autoupdate) : int|null
Parameters
$autoupdate : string

Interval string (e.g., "2h", "1d", "1w")

Return values
int|null

Interval in seconds or null if invalid

parseRssFeed()

Parse RSS/Atom feed and return article links.

public parseRssFeed(string $sourceUri, string $articleSection) : array<string|int, mixed>|false
Parameters
$sourceUri : string

Feed URL

$articleSection : string

Tag for inline text extraction

Return values
array<string|int, mixed>|false

Array of feed items or false on error

renderFeedLoadInterfaceModern()

Render feed loading interface using Alpine.js component.

public renderFeedLoadInterfaceModern(int $currentFeed, bool $checkAutoupdate, string $redirectUrl) : void

This method outputs JSON configuration that is consumed by the feed_loader_component.ts Alpine component.

Parameters
$currentFeed : int

Feed ID to load

$checkAutoupdate : bool

Whether checking auto-update

$redirectUrl : string

URL to redirect after completion

resetUnloadableArticles()

Reset unloadable articles (remove leading space from links).

public resetUnloadableArticles(string $feedIds) : int
Parameters
$feedIds : string

Comma-separated feed IDs

Return values
int

Number of reset articles

saveTextsFromFeed()

Save texts from feed wizard form data.

public saveTextsFromFeed(array<int, array{Nf_ID: int|string, TagList: string[], Nf_Max_Texts: int|null, TxLgID: int, TxTitle: string, TxText: string, TxAudioURI: string, TxSourceURI: string}> $texts) : array{textsArchived: int, sentencesDeleted: int, textItemsDeleted: int}

Creates texts from parsed feed data, applies tags, and archives old texts if max_texts limit is exceeded.

Parameters
$texts : array<int, array{Nf_ID: int|string, TagList: string[], Nf_Max_Texts: int|null, TxLgID: int, TxTitle: string, TxText: string, TxAudioURI: string, TxSourceURI: string}>

Array of text data from extractTextFromArticle()

Return values
array{textsArchived: int, sentencesDeleted: int, textItemsDeleted: int}

Archive statistics

updateFeed()

Update an existing feed.

public updateFeed(int $feedId, array<string|int, mixed> $data) : void
Parameters
$feedId : int

Feed ID

$data : array<string|int, mixed>

Feed data

validateRegexPattern()

Validate regex pattern for search.

public validateRegexPattern(string $pattern) : bool
Parameters
$pattern : string

Regex pattern

Return values
bool

True if valid

articleEntityToArray()

Convert Article entity to legacy array format.

private articleEntityToArray(Article $article) : array{FlID: int|null, FlNfID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, FlText: string}
Parameters
$article : Article

Article entity

Return values
array{FlID: int|null, FlNfID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, FlText: string}

Legacy array format

articleToLegacyArray()

Convert article result to legacy array format.

private articleToLegacyArray(Article, text_id: int|null, archived_id: int|null, status?: string} $item) : array{FlID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, TxID: int|null, ArchivedTxID: int|null}
Parameters
$item : Article, text_id: int|null, archived_id: int|null, status?: string}

Article result with status

Return values
array{FlID: int, FlTitle: string, FlLink: string, FlDescription: string, FlDate: string, FlAudio: string, TxID: int|null, ArchivedTxID: int|null}

Legacy array format

feedToArray()

Convert Feed entity to legacy array format.

private feedToArray(Feed $feed) : array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}
Parameters
$feed : Feed

Feed entity

Return values
array{NfID: int|null, NfLgID: int, NfName: string, NfSourceURI: string, NfArticleSectionTags: string, NfFilterTags: string, NfUpdate: int, NfOptions: string}

Legacy array format


        
On this page

Search results