EditStatisticsTrait
"Statistics" section of the edit page.
Shows the advert views chart (ChartJS). The granularity (daily, weekly, monthly, yearly) and
the date range are chosen by a form and travel in the GET parameters statG, statFrom and
statTo. A missing range falls back to the default of the granularity.
Tags
Table of Contents
Properties
Methods
- prepareEditStatistics() : void
- Prepares the data of the statistics tab; `renderEdit()` calls it only when the tab is active.
- parseStatDate() : DateTimeImmutable|null
- Parses a date in the Y-m-d format; returns null otherwise.
- resolveStatGranularity() : string
- Validates the granularity from the request against the allowed values.
- resolveStatRange() : DateTimeImmutable}
- Returns the date range from the request. When a bound is missing or invalid, the default range of the granularity is used.
Properties
$advertStatisticsManager
public
AdvertStatisticsManager
$advertStatisticsManager
Attributes
- #[Inject]
Methods
prepareEditStatistics()
Prepares the data of the statistics tab; `renderEdit()` calls it only when the tab is active.
protected
prepareEditStatistics() : void
parseStatDate()
Parses a date in the Y-m-d format; returns null otherwise.
private
parseStatDate(string $value) : DateTimeImmutable|null
Parameters
- $value : string
Return values
DateTimeImmutable|nullresolveStatGranularity()
Validates the granularity from the request against the allowed values.
private
resolveStatGranularity() : string
Return values
stringresolveStatRange()
Returns the date range from the request. When a bound is missing or invalid, the default range of the granularity is used.
private
resolveStatRange(string $granularity) : DateTimeImmutable}
Parameters
- $granularity : string
Return values
DateTimeImmutable} —[from, to]