$context */ public function __construct( private array $context ) {} /** * La requête traitée est de type POST * * @return bool */ public function isPostRequest(): bool { return ($this->context['collection_operation_name'] ?? null) === 'post'; } /** * La requête traitée est de type PUT * * @return bool */ public function isPutRequest(): bool { return ($this->context['item_operation_name'] ?? null) === 'put'; } /** * Retourne l'entité existante (avant mise à jour) si elle existe, null sinon * * @return mixed|null */ public function previousData() { return $this->context['previous_data'] ?? null; } }