mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix validation when leaving any household
This commit is contained in:
parent
e95d8fbc7a
commit
68ecff253a
@ -3,6 +3,7 @@
|
||||
namespace Chill\PersonBundle\Household;
|
||||
|
||||
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
use Symfony\Component\Validator\ConstraintViolationList;
|
||||
use Doctrine\Common\Collections\Criteria;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Household\Position;
|
||||
@ -94,7 +95,12 @@ class MembersEditor
|
||||
|
||||
public function validate(): ConstraintViolationListInterface
|
||||
{
|
||||
$list = $this->validator->validate($this->getHousehold(), null, [ self::VALIDATION_GROUP ]);
|
||||
if ($this->hasHousehold()) {
|
||||
$list = $this->validator
|
||||
->validate($this->getHousehold(), null, [ self::VALIDATION_GROUP ]);
|
||||
} else {
|
||||
$list = new ConstraintViolationList();
|
||||
}
|
||||
|
||||
foreach ($this->membershipsAffected as $m) {
|
||||
$list->addAll($this->validator->validate($m, null, [ self::VALIDATION_GROUP ]));
|
||||
|
Loading…
x
Reference in New Issue
Block a user