| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- declare(strict_types=1);
- namespace App\Service\Rest\Operation;
- use JetBrains\PhpStorm\Pure;
- /**
- * A single delete operation (a DELETE request)
- */
- class DeleteOperation extends BaseRestOperation
- {
- protected string $entity;
- protected int $id;
- #[Pure]
- public function __construct(string $label, string $entityName, array $initialData, array $options = []) {
- $id = (int)$initialData['id'];
- parent::__construct(
- $label,
- 'DELETE',
- $entityName . '/' . $id,
- [],
- [],
- $options
- );
- $this->entity = $entityName;
- $this->id = $id;
- }
- /**
- * @return string
- */
- public function getEntity(): string
- {
- return $this->entity;
- }
- protected function getExpectedResult(): ?array {
- return null;
- }
- /**
- * Return an array of messages describing the change that this operation will bring
- *
- * @return array
- */
- public function getChangeLog(): array {
- return [
- '[DELETE ' . $this->entity . '/' . $this->id . ']'
- ];
- }
- }
|