Merge remote-tracking branch 'origin/master' into features/household-edit-members-forms-improve-household

This commit is contained in:
Julien Fastré 2021-06-18 13:40:28 +02:00
commit e1f01a47f8
3 changed files with 50 additions and 37 deletions

View File

@ -177,4 +177,5 @@ class HouseholdController extends AbstractController
return $form;
}
}

View File

@ -340,21 +340,6 @@ class Household
return $this;
}
public function validate(ExecutionContextInterface $context, $payload)
{
$addresses = $this->getAddresses();
$cond = True;
for ($i=0; $i < count($addresses) - 1; $i++) {
if ($addresses[$i]->getValidFrom() != $addresses[$i + 1]->getValidTo()) {
$cond = False;
$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();
}
}
dump($cond);
}
public function getCommentMembers(): CommentEmbeddable
{
return $this->commentMembers;
@ -391,4 +376,18 @@ class Household
return $this;
}
public function validate(ExecutionContextInterface $context, $payload)
{
$addresses = $this->getAddresses();
$cond = True;
for ($i=0; $i < count($addresses) - 1; $i++) {
if ($addresses[$i]->getValidFrom() != $addresses[$i + 1]->getValidTo()) {
$cond = False;
$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();
}
}
dump($cond);
}
}

View File

@ -553,11 +553,24 @@ class AccompanyingCourseApiControllerTest extends WebTestCase
$center = $em->getRepository(Center::class)
->findOneBy(array('name' => 'Center A'));
$personIds = $em->createQuery("SELECT p.id FROM ".
Person::class." p ".
" WHERE p.center = :center")
$qb = $em->createQueryBuilder();
$personIds = $qb
->select('p.id')
->from(Person::class, 'p')
->where(
$qb->expr()->eq(
'p.center',
':center'
)
)
->andWhere(
$qb->expr()->gt(
'SIZE(p.accompanyingPeriodParticipations)',
0)
)
->setParameter('center', $center)
->setMaxResults($maxResults)
->getQuery()
->getScalarResult();
// create a random order