| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace App\Service\OnChange;
- class OnChangeContext
- {
- 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;
- }
- }
|