‪TYPO3CMS  ‪main
FileRemovedMessage.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 
29 #[WebhookMessage(
30  identifier: 'typo3/file-removed',
31  ‪description: 'LLL:EXT:webhooks/Resources/Private/Language/locallang_db.xlf:sys_webhook.webhook_type.typo3-file-removed'
32 )]
33 final class FileRemovedMessage implements ‪WebhookMessageInterface
34 {
35  public function __construct(
36  private readonly int $storageUid,
37  private readonly string ‪$identifier,
38  private readonly ?string ‪$publicUrl
39  ) {}
40 
41  public static function createFromEvent(‪BeforeFileDeletedEvent $event): self
42  {
43  $file = $event->‪getFile();
44  return new self($file->getStorage()->getUid(), $file->getIdentifier(), $file->getPublicUrl());
45  }
46 
47  public function jsonSerialize(): array
48  {
49  return [
50  'storage' => $this->storageUid,
51  'identifier' => ‪$this->identifier,
52  'url' => ‪$this->publicUrl,
53  ];
54  }
55 }
‪TYPO3\CMS\Core\Resource\Event\BeforeFileDeletedEvent
Definition: BeforeFileDeletedEvent.php:28
‪TYPO3\CMS\Core\Attribute\WebhookMessage
Definition: WebhookMessage.php:25
‪TYPO3\CMS\Webhooks\Message
Definition: FileAddedMessage.php:18
‪TYPO3\CMS\Core\Messaging\WebhookMessageInterface
Definition: WebhookMessageInterface.php:28
‪TYPO3\CMS\Webhooks\Message\$publicUrl
‪identifier readonly string readonly string $publicUrl
Definition: FileUpdatedMessage.php:36
‪TYPO3\CMS\Webhooks\Message\description
‪identifier description
Definition: FileAddedMessage.php:36
‪TYPO3\CMS\Core\Resource\Event\BeforeFileDeletedEvent\getFile
‪getFile()
Definition: BeforeFileDeletedEvent.php:31
‪TYPO3\CMS\Webhooks\Message\$identifier
‪identifier readonly string $identifier
Definition: FileAddedMessage.php:37