mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix validation for notification
This commit is contained in:
parent
8133dd7385
commit
2ff34688bb
@ -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;
|
||||
}
|
||||
|
@ -87,6 +87,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if appendCommentForm is not null %}
|
||||
<div class="new-comment my-5">
|
||||
<h2 class="chill-blue mb-4">{{ 'Write a new comment'|trans }}</h2>
|
||||
|
||||
@ -102,6 +103,7 @@
|
||||
{{ form_end(appendCommentForm) }}
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
|
@ -23,3 +23,8 @@ address:
|
||||
street1-should-be-set: Une ligne d'adresse doit être présente
|
||||
date-should-be-set: La date de début de validité doit être présente
|
||||
postcode-should-be-set: Le code postal doit être renseigné
|
||||
|
||||
notification:
|
||||
At least one addressee: Indiquez au moins un destinataire
|
||||
Title must be defined: Un titre doit être indiqué
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user