php code fix for Residential Address

This commit is contained in:
nobohan
2022-02-18 09:15:13 +01:00
parent 6e1b95aa60
commit c5d2953ecb
6 changed files with 13 additions and 17 deletions

View File

@@ -17,8 +17,6 @@ use DateTimeImmutable;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
use function Symfony\Component\DependencyInjection\Loader\Configurator\ref;
/**
* @method ResidentialAddress|null find($id, $lockMode = null, $lockVersion = null)
* @method ResidentialAddress|null findOneBy(array $criteria, array $orderBy = null)
@@ -38,10 +36,11 @@ class ResidentialAddressRepository extends ServiceEntityRepository
$date = null === $at ? new DateTimeImmutable('today') : $at;
foreach ($addresses as $a) {
if($a->getStartDate() < $date && $a->getEndDate() > $date) {
if ($a->getStartDate() < $date && $a->getEndDate() > $date) {
return $a;
}
}
return null;
}