InitialApprovalTrait
Approves a new record according to the single module setting "automatic approval" (key {@see InitialApprovalSetting::key()}: `advert.approval.auto` / `message.approval.auto`).
Shared by adverts (Bazaar, module 5), company profiles (Comcat, module 6) and discussion posts (Discussion, module 8):
- enabled:
approvedAtis set to now, so the record is published without an admin unless something else hides it (the generatedactivecolumn for adverts, theapprovedAt IS NOT NULLfront filters for posts), - disabled or missing key:
approvedAtis null and the record waits for admin approval.
deactivated is not derived from the setting: it is a separate state toggled by the owner
or an admin, so a new record always starts active. This applies to every insert through
the Api (front, external client and admin); the "approved" and "deactivated" switches an
admin sets while creating a record are overwritten.
Advert managers use it through AdvertInitialApprovalTrait.
Tags
Table of Contents
Methods
- applyInitialApproval() : void
Methods
applyInitialApproval()
private
applyInitialApproval(Advert|Advert|Message<mixed, mixed> $entity, int $module) : void