diff --git a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php index 6996eacea..be2676e35 100644 --- a/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php +++ b/src/Bundle/ChillMainBundle/Entity/Workflow/EntityWorkflow.php @@ -85,7 +85,7 @@ class EntityWorkflow implements TrackCreationInterface, TrackUpdateInterface */ #[Assert\Valid(traverse: true)] #[ORM\OneToMany(targetEntity: EntityWorkflowStep::class, mappedBy: 'entityWorkflow', orphanRemoval: true, cascade: ['persist'])] - #[ORM\OrderBy(['transitionAt' => Order::Ascending, 'id' => 'ASC'])] + #[ORM\OrderBy(['transitionAt' => 'ASC', 'id' => 'ASC'])] private Collection $steps; /** diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index fdea18901..543726eb2 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -40,7 +40,7 @@ class Household implements HasCentersInterface #[Serializer\Groups(['write'])] #[ORM\ManyToMany(targetEntity: Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])] #[ORM\JoinTable(name: 'chill_person_household_to_addresses')] - #[ORM\OrderBy(['validFrom' => Criteria::DESC, 'id' => 'DESC'])] + #[ORM\OrderBy(['validFrom' => 'DESC', 'id' => 'DESC'])] private Collection $addresses; #[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_members_')] @@ -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 ($i === 0) { + 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(); diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/create.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/create.html.twig index 2c36ae141..3071fe6e2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/create.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/create.html.twig @@ -19,7 +19,6 @@