This commit is contained in:
lubiana 2024-02-12 22:03:17 +01:00
parent 203233d2ed
commit 93fa2da696
45 changed files with 2633 additions and 550 deletions

View file

@ -1,12 +1,10 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
namespace App\Repository;
use App\Entity\FoodOrder;
use DateTime;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Persistence\ManagerRegistry;
/**
@ -25,17 +23,13 @@ class FoodOrderRepository extends ServiceEntityRepository
}
/**
* @return Collection<int, FoodOrder>
* @return FoodOrder[] Returns an array of FoodOrder objects
*/
public function findOpen(int $limit = 10): Collection
public function findOpenOrders(): array
{
$yesterday = new DateTime;
$yesterday->modify('-1 day');
$queryBuilder = $this->createQueryBuilder('e');
$queryBuilder
->where('e.closedAt IS NULL')
->andWhere($queryBuilder->expr()->gte('e.startedAt', ':yesterday'))
->setParameter('yesterday', $yesterday);
return new ArrayCollection($queryBuilder->getQuery()->getResult());
return $this->createQueryBuilder('f')
->andWhere('f.closedAt IS NULL')
->getQuery()
->getResult();
}
}

View file

@ -1,4 +1,5 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
namespace App\Repository;

View file

@ -1,4 +1,5 @@
<?php declare(strict_types=1);
<?php
declare(strict_types=1);
namespace App\Repository;