src/Entity/BulkQueueItem.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Account\Advertiser;
  4. use App\Repository\BulkQueueItemRepository;
  5. use Carbon\CarbonImmutable;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Table(name: 'bulk_queue')]
  8. #[ORM\Entity(repositoryClass: BulkQueueItemRepository::class)]
  9. #[ORM\InheritanceType('SINGLE_TABLE')]
  10. #[ORM\DiscriminatorColumn(name: 'entity_type', type: 'string', length: 12)]
  11. #[ORM\DiscriminatorMap(['profile' => Profile\BulkQueueItem::class, 'saloon' => Saloon\BulkQueueItem::class, 'support_msg' => Support\BulkQueueItem::class
  12. ])]
  13. abstract class BulkQueueItem
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\Column(name: 'id', type: 'smallint')]
  17.     #[ORM\GeneratedValue(strategy: 'AUTO')]
  18.     protected int $id;
  19.     #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', nullable: true)]
  20.     #[ORM\ManyToOne(targetEntity: Advertiser::class)]
  21.     protected ?Advertiser $owner;
  22.     #[ORM\Column(name: '`action`', type: 'string')]
  23.     protected string $action;
  24.     #[ORM\Column(name: 'entities', type: 'json')]
  25.     protected array $entities;
  26.     #[ORM\Column(name: 'date', type: 'datetime_immutable')]
  27.     protected $date;
  28.     #[ORM\Column(name: 'process_date', type: 'datetime_immutable', nullable: true)]
  29.     protected ?\DateTimeInterface $processDate = null;
  30.     #[ORM\Column(name: 'is_handled', type: 'boolean', options: ['default' => 0])]
  31.     protected bool $isHandled = false;
  32.     public function __construct(?Advertiser $owner, string $action, array $ids)
  33.     {
  34.         $this->owner = $owner;
  35.         $this->action = $action;
  36.         $this->entities = $ids;
  37.         $this->date = CarbonImmutable::now();
  38.     }
  39.     public function getId(): int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getAction(): string
  44.     {
  45.         return $this->action;
  46.     }
  47.     public function getOwner(): ?Advertiser
  48.     {
  49.         return $this->owner;
  50.     }
  51.     public function getEntities(): array
  52.     {
  53.         return $this->entities;
  54.     }
  55.     public function isHandled(): bool
  56.     {
  57.         return $this->isHandled;
  58.     }
  59.     public function setIsHandled(bool $value): void
  60.     {
  61.         $this->isHandled = $value;
  62.     }
  63.     public function getProcessDate(): ?\DateTimeInterface
  64.     {
  65.         return $this->processDate;
  66.     }
  67.     public function setProcessDate(?\DateTimeInterface $processDate): void
  68.     {
  69.         $this->processDate = $processDate;
  70.     }
  71. }