|
|
@@ -3,13 +3,17 @@ declare(strict_types=1);
|
|
|
|
|
|
namespace App\Entity\Message;
|
|
|
|
|
|
+use App\Annotation\OrganizationDefaultValue;
|
|
|
use App\Entity\Organization\Organization;
|
|
|
+use App\Enum\Message\MessageStatusEnum;
|
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
+use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
|
|
/**
|
|
|
* Classe ... qui ...
|
|
|
*/
|
|
|
#[ORM\MappedSuperclass]
|
|
|
+#[OrganizationDefaultValue(fieldName: "organization")]
|
|
|
abstract class AbstractMessage
|
|
|
{
|
|
|
#[ORM\Id]
|
|
|
@@ -17,12 +21,97 @@ abstract class AbstractMessage
|
|
|
#[ORM\GeneratedValue]
|
|
|
protected ?int $id = null;
|
|
|
|
|
|
+ #[ORM\Column]
|
|
|
+ protected ?string $uniqueSendId = null;
|
|
|
+
|
|
|
#[ORM\ManyToOne]
|
|
|
#[ORM\JoinColumn(nullable: true)]
|
|
|
protected Organization $organization;
|
|
|
|
|
|
+ #[ORM\Column(type: 'string', options: ['default' => 'DRAFT'])]
|
|
|
+ #[Assert\Choice(callback: [MessageStatusEnum::class, 'toArray'], message: 'invalid-departure-cause')]
|
|
|
+ protected string $status;
|
|
|
+
|
|
|
+ #[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 setUniqueSendId(string $uniqueSendId): self
|
|
|
+ {
|
|
|
+ $this->uniqueSendId = $uniqueSendId;
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getUniqueSendId(): string
|
|
|
+ {
|
|
|
+ return $this->uniqueSendId;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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(string $status)
|
|
|
+ {
|
|
|
+ $this->status = $status;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getStatus(): string
|
|
|
+ {
|
|
|
+ return $this->status;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function setDateSent(\DateTimeInterface $dateSent)
|
|
|
+ {
|
|
|
+ $this->dateSent = $dateSent;
|
|
|
+
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getDateSent(): ?\DateTimeInterface
|
|
|
+ {
|
|
|
+ return $this->dateSent;
|
|
|
+ }
|
|
|
}
|