src/Entity/SalesHistory.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Enum\SalesHistoryEventType;
  4. use App\Repository\SalesHistoryRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassSalesHistoryRepository::class)]
  8. #[ORM\Table(name'sales_history')]
  9. class SalesHistory extends BaseEntity
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private ?int $id null;
  15.     #[ORM\ManyToOne(targetEntitySales::class, inversedBy'historyEntries')]
  16.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  17.     private ?Sales $sale null;
  18.     #[ORM\ManyToOne(targetEntityUser::class)]
  19.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  20.     private ?User $performedBy null;
  21.     #[ORM\Column(length150nullabletrue)]
  22.     private ?string $performedByName null;
  23.     #[ORM\Column(length180nullabletrue)]
  24.     private ?string $performedByEmail null;
  25.     #[ORM\Column(type'string'length50enumTypeSalesHistoryEventType::class)]
  26.     private SalesHistoryEventType $eventType;
  27.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  28.     private ?string $description null;
  29.     #[ORM\Column(typeTypes::JSONnullabletrue)]
  30.     private ?array $context null;
  31.     #[ORM\Column(type'datetime_immutable')]
  32.     private \DateTimeImmutable $performedAt;
  33.     #[ORM\ManyToOne(targetEntityEmailMessage::class)]
  34.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  35.     private ?EmailMessage $emailMessage null;
  36.     #[ORM\ManyToOne(targetEntityEmailRecipient::class)]
  37.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  38.     private ?EmailRecipient $emailRecipient null;
  39.     public function __construct()
  40.     {
  41.         $this->performedAt = new \DateTimeImmutable();
  42.         $this->eventType SalesHistoryEventType::CREATED;
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getSale(): ?Sales
  49.     {
  50.         return $this->sale;
  51.     }
  52.     public function setSale(Sales $sale): self
  53.     {
  54.         $this->sale $sale;
  55.         return $this;
  56.     }
  57.     public function getPerformedBy(): ?User
  58.     {
  59.         return $this->performedBy;
  60.     }
  61.     public function setPerformedBy(?User $performedBy): self
  62.     {
  63.         $this->performedBy $performedBy;
  64.         return $this;
  65.     }
  66.     public function getPerformedByName(): ?string
  67.     {
  68.         return $this->performedByName;
  69.     }
  70.     public function setPerformedByName(?string $performedByName): self
  71.     {
  72.         $this->performedByName $performedByName;
  73.         return $this;
  74.     }
  75.     public function getPerformedByEmail(): ?string
  76.     {
  77.         return $this->performedByEmail;
  78.     }
  79.     public function setPerformedByEmail(?string $performedByEmail): self
  80.     {
  81.         $this->performedByEmail $performedByEmail;
  82.         return $this;
  83.     }
  84.     public function getEventType(): SalesHistoryEventType
  85.     {
  86.         return $this->eventType;
  87.     }
  88.     public function setEventType(SalesHistoryEventType $eventType): self
  89.     {
  90.         $this->eventType $eventType;
  91.         return $this;
  92.     }
  93.     public function getDescription(): ?string
  94.     {
  95.         return $this->description;
  96.     }
  97.     public function setDescription(?string $description): self
  98.     {
  99.         $this->description $description;
  100.         return $this;
  101.     }
  102.     public function getContext(): ?array
  103.     {
  104.         return $this->context;
  105.     }
  106.     public function setContext(?array $context): self
  107.     {
  108.         $this->context $context;
  109.         return $this;
  110.     }
  111.     public function getPerformedAt(): \DateTimeImmutable
  112.     {
  113.         return $this->performedAt;
  114.     }
  115.     public function setPerformedAt(\DateTimeImmutable $performedAt): self
  116.     {
  117.         $this->performedAt $performedAt;
  118.         return $this;
  119.     }
  120.     public function getEmailMessage(): ?EmailMessage
  121.     {
  122.         return $this->emailMessage;
  123.     }
  124.     public function setEmailMessage(?EmailMessage $emailMessage): self
  125.     {
  126.         $this->emailMessage $emailMessage;
  127.         return $this;
  128.     }
  129.     public function getEmailRecipient(): ?EmailRecipient
  130.     {
  131.         return $this->emailRecipient;
  132.     }
  133.     public function setEmailRecipient(?EmailRecipient $emailRecipient): self
  134.     {
  135.         $this->emailRecipient $emailRecipient;
  136.         return $this;
  137.     }
  138. }