feat: add booking time ranges and repeating series
This commit is contained in:
1 parent
59feca2f8e
commit
d433d271d0
29 files changed
+2135
-180
No files matched your search
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Repository;
|
||||
|
||||
use App\Entity\BookingSeries;
|
||||
use App\Entity\User;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<BookingSeries>
|
||||
*/
|
||||
class BookingSeriesRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, BookingSeries::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<BookingSeries>
|
||||
*/
|
||||
public function findActiveForUser(User $user, \DateTimeImmutable $on): array
|
||||
{
|
||||
return $this->createQueryBuilder('s')
|
||||
->addSelect('r')
|
||||
->join('s.resource', 'r')
|
||||
->andWhere('s.user = :user')
|
||||
->andWhere('s.endDate >= :on')
|
||||
->setParameter('user', $user)
|
||||
->setParameter('on', $on->setTime(0, 0))
|
||||
->orderBy('s.startDate', 'ASC')
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user