mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
fix validation for notification
This commit is contained in:
@@ -17,6 +17,7 @@ use DateTimeInterface;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
@@ -32,6 +33,7 @@ class Notification implements TrackUpdateInterface
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity=User::class)
|
||||
* @ORM\JoinTable(name="chill_main_notification_addresses_user")
|
||||
* @Assert\Count(min="1", minMessage="notification.At least one addressee")
|
||||
*/
|
||||
private Collection $addressees;
|
||||
|
||||
@@ -80,6 +82,7 @@ class Notification implements TrackUpdateInterface
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="text", options={"default": ""})
|
||||
* @Assert\NotBlank(message="notification.Title must be defined")
|
||||
*/
|
||||
private string $title = '';
|
||||
|
||||
@@ -286,9 +289,9 @@ class Notification implements TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setMessage(string $message): self
|
||||
public function setMessage(?string $message): self
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->message = (string) $message;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -314,9 +317,9 @@ class Notification implements TrackUpdateInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setTitle(string $title): Notification
|
||||
public function setTitle(?string $title): Notification
|
||||
{
|
||||
$this->title = $title;
|
||||
$this->title = (string) $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user