mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
fix validation groups and sequential validator msg
This commit is contained in:
@@ -19,6 +19,8 @@ class MembersEditor
|
||||
private array $persistables = [];
|
||||
private array $membershipsAffected = [];
|
||||
|
||||
public const VALIDATION_GROUP = 'household_memberships';
|
||||
|
||||
public function __construct(ValidatorInterface $validator, ?Household $household)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
@@ -41,12 +43,12 @@ class MembersEditor
|
||||
$this->household->addMember($membership);
|
||||
|
||||
if ($position->getShareHousehold()) {
|
||||
foreach ($person->getHouseholdParticipations() as $participation) {
|
||||
if (FALSE === $participation->getShareHousehold()) {
|
||||
foreach ($person->getHouseholdParticipationsShareHousehold() as $participation) {
|
||||
if ($participation === $membership) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($participation === $membership) {
|
||||
if ($participation->getStartDate() > $membership->getStartDate()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -92,7 +94,13 @@ class MembersEditor
|
||||
|
||||
public function validate(): ConstraintViolationListInterface
|
||||
{
|
||||
return $this->validator->validate($this->getHousehold(), null, [ "memberships" ]);
|
||||
$list = $this->validator->validate($this->getHousehold(), null, [ self::VALIDATION_GROUP ]);
|
||||
|
||||
foreach ($this->membershipsAffected as $m) {
|
||||
$list->addAll($this->validator->validate($m, null, [ self::VALIDATION_GROUP ]));
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
public function getPersistable(): array
|
||||
|
Reference in New Issue
Block a user