mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
activity admin: change validation rule for social action visible field
This commit is contained in:
parent
6df570d96c
commit
33f393203e
@ -16,6 +16,7 @@ use InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Annotation as Serializer;
|
||||
use Symfony\Component\Serializer\Annotation\Groups;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
|
||||
/**
|
||||
* Class ActivityType.
|
||||
@ -193,7 +194,6 @@ class ActivityType
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
|
||||
* @Assert\EqualTo(propertyPath="socialIssuesVisible", message="This parameter must be equal to social issue parameter")
|
||||
*/
|
||||
private int $socialActionsVisible = self::FIELD_INVISIBLE;
|
||||
|
||||
@ -263,6 +263,23 @@ class ActivityType
|
||||
*/
|
||||
private int $userVisible = self::FIELD_REQUIRED;
|
||||
|
||||
/**
|
||||
* @Assert\Callback
|
||||
*
|
||||
* @param mixed $payload
|
||||
*/
|
||||
public function checkSocialActionsVisibility(ExecutionContextInterface $context, $payload)
|
||||
{
|
||||
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {
|
||||
if (!($this->socialIssuesVisible === 2 && $this->socialActionsVisible === 1)) {
|
||||
$context
|
||||
->buildViolation('The socialActionsVisible value is not compatible with the socialIssuesVisible value')
|
||||
->atPath('socialActionsVisible')
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get active
|
||||
* return true if the type is active.
|
||||
|
@ -20,3 +20,4 @@ For this type of activity, you must add at least one social action: Pour ce type
|
||||
|
||||
# admin
|
||||
This parameter must be equal to social issue parameter: Ce paramètre doit être égal au paramètre "Visibilité du champs Problématiques sociales"
|
||||
The socialActionsVisible value is not compatible with the socialIssuesVisible value: Cette valeur du paramètre "Visibilité du champs Actions sociales" n'est pas compatible avec la valeur du paramètre "Visibilité du champs Problématiques sociales"
|
Loading…
x
Reference in New Issue
Block a user