mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-31 03:53:49 +00:00
merge upgrade-sf5 into branch for latest fixes
This commit is contained in:
@@ -592,14 +592,15 @@ class Household implements HasCentersInterface
|
||||
}
|
||||
|
||||
#[Assert\Callback]
|
||||
public function validate(ExecutionContextInterface $context, $payload)
|
||||
public function validate(ExecutionContextInterface $context, $payload): void
|
||||
{
|
||||
$addresses = $this->getAddresses();
|
||||
$cond = true;
|
||||
$addresses = $this->getAddressesOrdered();
|
||||
|
||||
for ($i = 0; \count($addresses) - 1 > $i; ++$i) {
|
||||
if ($addresses[$i]->getValidFrom() !== $addresses[$i + 1]->getValidTo()) {
|
||||
$cond = false;
|
||||
if (0 === $i) {
|
||||
continue;
|
||||
}
|
||||
if ($addresses[$i - 1]->getValidTo() !== $addresses[$i]->getValidFrom()) {
|
||||
$context->buildViolation('The address are not sequentials. The validFrom date of one address should be equal to the validTo date of the previous address.')
|
||||
->atPath('addresses')
|
||||
->addViolation();
|
||||
|
Reference in New Issue
Block a user