Bånder

RecommendationService
in package

Table of Contents

Properties

$calculators  : array<string, CalculatorInterface>
Registered recommendation calculators
$logger  : LoggerInterface

Methods

__construct()  : mixed
Constructor with dependency injection
clearModelRecommendationCache()  : void
Clear cache for a specific model instance
clearRecommendationCache()  : void
Clear cache for a specific recommendation set
generateRecommendations()  : int
Generate recommendations for all models of a specific class
generateRecommendationsForModel()  : int
Generate recommendations for a specific model instance
getAvailableAlgorithms()  : array<string|int, mixed>
Get available algorithms
getCalculator()  : CalculatorInterface
Get calculator for an algorithm
getRecommendations()  : Collection
Get recommendations for a model with optional caching
registerCalculator()  : $this
Register a calculator for a specific algorithm
fetchRecommendations()  : Collection
Fetch recommendations from the database
saveRecommendations()  : int
Save calculated recommendations to the database

Properties

Methods

__construct()

Constructor with dependency injection

public __construct(LoggerInterface $logger) : mixed
Parameters
$logger : LoggerInterface

clearModelRecommendationCache()

Clear cache for a specific model instance

public clearModelRecommendationCache(Model $model, string $name) : void
Parameters
$model : Model
$name : string

clearRecommendationCache()

Clear cache for a specific recommendation set

public clearRecommendationCache(string $modelClass, string $name) : void
Parameters
$modelClass : string
$name : string

generateRecommendations()

Generate recommendations for all models of a specific class

public generateRecommendations(string $modelClass, string $name[, array<string|int, mixed> $options = [] ]) : int
Parameters
$modelClass : string
$name : string
$options : array<string|int, mixed> = []

Additional options for generation

Return values
int

generateRecommendationsForModel()

Generate recommendations for a specific model instance

public generateRecommendationsForModel(Model $model, string $name) : int
Parameters
$model : Model
$name : string
Return values
int

getAvailableAlgorithms()

Get available algorithms

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

getRecommendations()

Get recommendations for a model with optional caching

public getRecommendations(Model $model, string $name[, bool $refresh = false ]) : Collection
Parameters
$model : Model
$name : string
$refresh : bool = false

Force refresh even when cache is enabled

Return values
Collection

fetchRecommendations()

Fetch recommendations from the database

private fetchRecommendations(Model $model, string $name) : Collection
Parameters
$model : Model
$name : string
Return values
Collection

saveRecommendations()

Save calculated recommendations to the database

private saveRecommendations(string $modelClass, string $name, array<string|int, mixed> $recommendations, array<string|int, mixed> $config, array<string|int, mixed> $options) : int
Parameters
$modelClass : string
$name : string
$recommendations : array<string|int, mixed>
$config : array<string|int, mixed>
$options : array<string|int, mixed>
Return values
int

        
On this page

Search results