<?phpnamespace App\Entity;use App\Repository\NotificationRepository;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Gedmo\Blameable\Traits\BlameableEntity;use Gedmo\Timestampable\Traits\TimestampableEntity;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: NotificationRepository::class)]#[UniqueEntity('key')]class Notification{ use TimestampableEntity; //Hook timestampable behavior. Updates createdAt, updatedAt fields use BlameableEntity; //Hook blameable behavior. Updates createdBy, updatedBy fields const NOTIFICATION_TYPE_EMAIL = 'EMAIL_NOTIFICATION'; const ORDER_CREATED = "ORDER_CREATED"; const USER_REGISTERED = "USER_REGISTERED"; const ON_RESET_PASSWORD = "ON_RESET_PASSWORD"; const EXECUTE_AUTHORIZATION_PAYMENT = "EXECUTE_AUTHORIZATION_PAYMENT"; const CANCEL_PREAUTHORIZATION_PAYMENT = "CANCEL_PREAUTHORIZATION_PAYMENT"; const NEW_RETURN = "NEW_RETURN"; const NEW_FRIEND = "NEW_FRIEND"; const ON_USER_DEACTIVATION = "ON_USER_DEACTIVATION"; const CANCEL_CHILDREN_ORDER = "CANCEL_CHILDREN_ORDER"; #[ORM\Id] #[ORM\GeneratedValue(strategy: "IDENTITY")] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 100, unique: true)] #[Assert\NotNull()] #[Assert\Length(max: 100)] private ?string $key = null; #[ORM\Column(length: 50)] #[Assert\NotNull()] #[Assert\Length(max: 50)] private ?string $type = null; #[ORM\Column] #[Assert\NotNull()] private ?bool $active = true; #[ORM\Column(length: 255)] private ?string $title = null; #[ORM\Column(type: Types::TEXT)] private ?string $body = null; public function __toString() { return $this->getKey(); } public function getId(): ?int { return $this->id; } public function getKey(): ?string { return $this->key; } public function setKey(string $key): self { $this->key = $key; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; return $this; } public function isActive(): ?bool { return $this->active; } public function setActive(bool $active): self { $this->active = $active; return $this; } public function getTitle(): ?string { return $this->title; } public function getReplacedTitle($replacements): ?string { return str_replace(array_keys($replacements), array_values($replacements), $this->title); } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getBody(): ?string { return $this->body; } public function getReplacedBody($replacements): ?string { return str_replace(array_keys($replacements), array_values($replacements), $this->body); } public function setBody(string $body): self { $this->body = $body; return $this; }}