| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Message;
- use App\Attribute\OrganizationDefaultValue;
- use App\Entity\Organization\Organization;
- use App\Enum\Message\MessageStatusEnum;
- use Doctrine\ORM\Mapping as ORM;
- use Ramsey\Uuid\Doctrine\UuidGenerator;
- use Ramsey\Uuid\UuidInterface;
- /**
- * Classe ... qui ...
- */
- #[ORM\MappedSuperclass]
- #[OrganizationDefaultValue(fieldName: 'organization')]
- abstract class AbstractMessage
- {
- /**
- * IMPORTANT! Cette propriété doit être déclarée avant l'id, pour prévenir un bug doctrine.
- *
- * @see https://github.com/doctrine/orm/issues/7215
- */
- #[ORM\Column(type: 'uuid', unique: true)]
- #[ORM\GeneratedValue(strategy: 'CUSTOM')]
- #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
- protected ?UuidInterface $uuid = null;
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- protected ?int $id = null;
- #[ORM\Column(length: 255, nullable: false)]
- protected string $discr;
- #[ORM\ManyToOne]
- #[ORM\JoinColumn(nullable: true)]
- protected Organization $organization;
- #[ORM\Column(length: 50, enumType: MessageStatusEnum::class, options: ['default' => 'DRAFT'])]
- protected MessageStatusEnum $status = MessageStatusEnum::DRAFT;
- // @todo remplacer par le nom sendingDate
- #[ORM\Column(type: 'datetime', nullable: true)]
- protected ?\DateTimeInterface $dateSent = null;
- #[ORM\Column(type: 'string', length: 255, nullable: true)]
- protected string $about;
- #[ORM\Column(type: 'text', nullable: true)]
- protected string $text;
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getUuid(): ?UuidInterface
- {
- return $this->uuid;
- }
- public function setOrganization(Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- public function getOrganization(): Organization
- {
- return $this->organization;
- }
- public function setAbout(string $about): self
- {
- $this->about = $about;
- return $this;
- }
- public function getAbout(): string
- {
- return $this->about;
- }
- public function setText(string $text): self
- {
- $this->text = $text;
- return $this;
- }
- public function getText(): string
- {
- return html_entity_decode($this->text);
- }
- public function setStatus(MessageStatusEnum $status): self
- {
- $this->status = $status;
- return $this;
- }
- public function getStatus(): MessageStatusEnum
- {
- return $this->status;
- }
- public function setDateSent(\DateTimeInterface $dateSent): self
- {
- $this->dateSent = $dateSent;
- return $this;
- }
- public function getDateSent(): ?\DateTimeInterface
- {
- return $this->dateSent;
- }
- }
|