mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 05:44:24 +00:00
Merge remote-tracking branch 'origin/master' into features/household-edit-members-forms-improve-household
This commit is contained in:
commit
e1f01a47f8
@ -177,4 +177,5 @@ class HouseholdController extends AbstractController
|
|||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -340,21 +340,6 @@ class Household
|
|||||||
return $this;
|
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
|
public function getCommentMembers(): CommentEmbeddable
|
||||||
{
|
{
|
||||||
return $this->commentMembers;
|
return $this->commentMembers;
|
||||||
@ -391,4 +376,18 @@ class Household
|
|||||||
return $this;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -553,11 +553,24 @@ class AccompanyingCourseApiControllerTest extends WebTestCase
|
|||||||
$center = $em->getRepository(Center::class)
|
$center = $em->getRepository(Center::class)
|
||||||
->findOneBy(array('name' => 'Center A'));
|
->findOneBy(array('name' => 'Center A'));
|
||||||
|
|
||||||
$personIds = $em->createQuery("SELECT p.id FROM ".
|
$qb = $em->createQueryBuilder();
|
||||||
Person::class." p ".
|
$personIds = $qb
|
||||||
" WHERE p.center = :center")
|
->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)
|
->setParameter('center', $center)
|
||||||
->setMaxResults($maxResults)
|
->setMaxResults($maxResults)
|
||||||
|
->getQuery()
|
||||||
->getScalarResult();
|
->getScalarResult();
|
||||||
|
|
||||||
// create a random order
|
// create a random order
|
||||||
|
Loading…
x
Reference in New Issue
Block a user