AdvertCategoryPolicyTrait
Category policy of an advert save (Bazaar, Comcat): a non-privileged caller may put an advert only into an active category (with active ancestors) that is not "only for administrator".
The front used to offer disabled and admin-only categories in the insert form, and the Api did not
check them, so a visitor could insert an advert there (also through ?catId[]=). The caller tier
comes from the Api gate (FieldAudienceContext), never from the request; an unresolved audience
(cron, CLI, internal code) is not checked.
Requires in the host class: $this->em (EntityManagerInterface), $this->fieldAudienceContext
(?FieldAudienceContext) and advertCategoryTable(): string.
Table of Contents
Methods
- advertCategoryTable() : string
- guardCategoryPolicy() : Result|null
Methods
advertCategoryTable()
protected
abstract advertCategoryTable() : string
Return values
stringguardCategoryPolicy()
private
guardCategoryPolicy(array<int, int> $categoryIds) : Result|null
Parameters
- $categoryIds : array<int, int>