src/Entity/PhotoUploadErrorReport.php line 40
<?php/** This file is part of the Pellipop project.** (c) Mobizel** For the full copyright and license information, please view the LICENSE* file that was distributed with this source code.*/declare(strict_types=1);namespace App\Entity;use App\Entity\IdentifiableTrait;use App\Entity\Order\Order;use App\Entity\Order\OrderItemPhoto;use App\Repository\PhotoUploadErrorReportRepository;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Gedmo\Timestampable\Traits\TimestampableEntity;use Sylius\Component\Resource\Annotation\SyliusCrudRoutes;use Sylius\Component\Resource\Model\ResourceInterface;#[ORM\Entity(repositoryClass: PhotoUploadErrorReportRepository::class)]#[ORM\Table(name: 'app_photo_upload_error_report')]#[SyliusCrudRoutes(alias: 'app.photo_upload_error_report', path: '/admin/photo-upload-errors', section: 'backend', templates: 'backend/photo_upload_error_report', grid: 'app_backend_photo_upload_error_report', only: ['index', 'show'], vars: ['all' => ['subheader' => 'app.ui.photo_upload_errors',],'index' => ['icon' => 'exclamation triangle',],])]#[ORM\Index(columns: ['order_id'], name: 'idx_order_id')]#[ORM\Index(columns: ['photo_id'], name: 'idx_photo_id')]#[ORM\Index(columns: ['error_type'], name: 'idx_error_type')]#[ORM\Index(columns: ['resolved'], name: 'idx_resolved')]class PhotoUploadErrorReport implements ResourceInterface{use IdentifiableTrait;use TimestampableEntity;public const ERROR_TYPE_FILE_MISSING = 'file_missing';public const ERROR_TYPE_FILE_CORRUPTED = 'file_corrupted';public const ERROR_TYPE_STATE_TRANSITION = 'state_transition';public const ERROR_TYPE_FUJI_SERVER = 'fuji_server';public const ERROR_TYPE_NETWORK = 'network';public const ERROR_TYPE_COMPRESSION = 'compression';public const ERROR_TYPE_UNKNOWN = 'unknown';public const SOURCE_API = 'api';public const SOURCE_COMMAND = 'command';public const SOURCE_APP = 'app';#[ORM\ManyToOne(targetEntity: Order::class)]#[ORM\JoinColumn(name: 'order_id', referencedColumnName: 'id', nullable: true, onDelete: 'CASCADE')]private ?Order $order = null;#[ORM\ManyToOne(targetEntity: OrderItemPhoto::class)]#[ORM\JoinColumn(name: 'photo_id', referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]private ?OrderItemPhoto $photo = null;#[ORM\Column(length: 50)]private string $errorType;#[ORM\Column(length: 20)]private string $source;#[ORM\Column(type: Types::TEXT)]private string $errorMessage;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $stackTrace = null;#[ORM\Column(type: Types::JSON, nullable: true)]private ?array $context = null;#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]private bool $resolved = false;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $resolutionNote = null;#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]private ?\DateTimeImmutable $resolvedAt = null;public function getId(): ?int{return $this->id;}public function getOrder(): ?Order{return $this->order;}public function setOrder(?Order $order): self{$this->order = $order;return $this;}public function getPhoto(): ?OrderItemPhoto{return $this->photo;}public function setPhoto(?OrderItemPhoto $photo): self{$this->photo = $photo;return $this;}public function getErrorType(): string{return $this->errorType;}public function setErrorType(string $errorType): self{$this->errorType = $errorType;return $this;}public function getSource(): string{return $this->source;}public function setSource(string $source): self{$this->source = $source;return $this;}public function getErrorMessage(): string{return $this->errorMessage;}public function setErrorMessage(string $errorMessage): self{$this->errorMessage = $errorMessage;return $this;}public function getStackTrace(): ?string{return $this->stackTrace;}public function setStackTrace(?string $stackTrace): self{$this->stackTrace = $stackTrace;return $this;}public function getContext(): ?array{return $this->context;}public function setContext(?array $context): self{$this->context = $context;return $this;}public function isResolved(): bool{return $this->resolved;}public function setResolved(bool $resolved): self{$this->resolved = $resolved;if ($resolved && $this->resolvedAt === null) {$this->resolvedAt = new \DateTimeImmutable();} elseif (!$resolved) {$this->resolvedAt = null;}return $this;}public function getResolutionNote(): ?string{return $this->resolutionNote;}public function setResolutionNote(?string $resolutionNote): self{$this->resolutionNote = $resolutionNote;return $this;}public function getResolvedAt(): ?\DateTimeImmutable{return $this->resolvedAt;}public function setResolvedAt(?\DateTimeImmutable $resolvedAt): self{$this->resolvedAt = $resolvedAt;return $this;}public static function getErrorTypeChoices(): array{return [self::ERROR_TYPE_FILE_MISSING => 'Fichier manquant',self::ERROR_TYPE_FILE_CORRUPTED => 'Fichier corrompu',self::ERROR_TYPE_STATE_TRANSITION => 'Transition d\'état impossible',self::ERROR_TYPE_FUJI_SERVER => 'Erreur serveur Fuji',self::ERROR_TYPE_NETWORK => 'Erreur réseau',self::ERROR_TYPE_UNKNOWN => 'Erreur inconnue',];}public static function getSourceChoices(): array{return [self::SOURCE_API => 'API',self::SOURCE_COMMAND => 'Commande',self::SOURCE_APP => 'Application mobile',];}}