Deprecated: Return type of Google\Model::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 256

Deprecated: Return type of Google\Model::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 261

Deprecated: Return type of Google\Model::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 268

Deprecated: Return type of Google\Model::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Model.php on line 278

Deprecated: Return type of Google\Collection::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 22

Deprecated: Return type of Google\Collection::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 38

Deprecated: Return type of Google\Collection::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 30

Deprecated: Return type of Google\Collection::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 43

Deprecated: Return type of Google\Collection::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 14

Deprecated: Return type of Google\Collection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/sanralsmme/vendor/google/apiclient/src/Collection.php on line 49
Symfony Profiler

src/Repository/TendersRepository.php line 50

Open in your IDE?
  1. <?php
  2. namespace App\Repository;
  3. use App\Entity\Tenders;
  4. use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  5. use Doctrine\Persistence\ManagerRegistry;
  6. class TendersRepository extends ServiceEntityRepository
  7. {
  8.     public function __construct(ManagerRegistry $registry)
  9.     {
  10.         parent::__construct($registryTenders::class);
  11.     }
  12.     /**
  13.      * @return Tenders[]
  14.      */
  15.     public function getTendersClosing():array
  16.     {
  17.         $now = new \DateTime();
  18.         $closing_soon $this->createQueryBuilder('t')
  19.             ->andWhere('t.closingDate <= :close')
  20.             ->setParameter('close', new \DateTime('+14 days'))
  21.             ->andWhere('t.closingDate > :now')
  22.             ->setParameter('now'$now)
  23.             ->orderBy('t.closingDate''DESC')
  24.             ->setMaxResults(3)
  25.             ->getQuery()->execute();
  26.         return $closing_soon;
  27.     }
  28.     public function getTenders($status,$region):array
  29.     {
  30.         $tenders $this->createQueryBuilder('t')
  31.             ->andWhere('t.status = :status')
  32.             ->setParameter('status'$status)
  33.             ->andWhere('t.region = :region')
  34.             ->setParameter('region'$region)
  35.             ->orderBy('t.closingDate''DESC')
  36.             ->setMaxResults(3)
  37.             ->getQuery()->execute();
  38.         return $tenders;
  39.     }
  40.     public function getTendersByStatus($status):array
  41.     {
  42.         $tenders $this->createQueryBuilder('t')
  43.             ->andWhere('t.status = :status')
  44.             ->setParameter('status'$status)
  45.             ->orderBy('t.closingDate''DESC')
  46.             ->getQuery()->execute();
  47.         return $tenders;
  48.     }
  49.     public function getTendersByRegion($region):array
  50.     {
  51.         $tenders $this->createQueryBuilder('t')
  52.             ->andWhere('t.region = :region')
  53.             ->setParameter('region'$region)
  54.             ->orderBy('t.closingDate''DESC')
  55.             ->getQuery()->execute();
  56.         return $tenders;
  57.     }
  58.     public function getTenderSearchResults($region null$category null$status null):array
  59.     {
  60.         $queryBuilder $this->createQueryBuilder('t');
  61.         $queryBuilder->select('t','c','r')
  62.             ->leftJoin('t.category''c')
  63.             ->leftJoin('t.region''r');
  64.         if($region != null){
  65.             $queryBuilder->andWhere('t.region = :region')
  66.                     ->setParameter('region'$region);
  67.         }
  68.         if($category != null){
  69.             $queryBuilder->andWhere('t.category = :category')
  70.                 ->setParameter('category'$category);
  71.         }
  72.         if($status != null){
  73.             $queryBuilder->andWhere('t.status = :status')
  74.                 ->setParameter('status'$status);
  75.         }
  76.         $queryBuilder->orderBy('t.closingDate''DESC');
  77.         $results $queryBuilder->getQuery()->execute();
  78.         return $results;
  79.     }
  80.     public function getActiveTenders(): array
  81.     {
  82.         $queryBuilder $this->createQueryBuilder('t')
  83.             ->andWhere('t.status = :status')
  84.             ->setParameter('status'1)
  85.             ->getQuery()->execute();
  86.         return $queryBuilder;
  87.     }
  88.     public function getClosedTenders():array
  89.     {
  90.         $queryBuilder $this->createQueryBuilder('t')
  91.         ->andWhere('t.status = :status')
  92.         ->setParameter('status'4)
  93.         ->getQuery()->execute();
  94.     return $queryBuilder;
  95.     }
  96.     public function getTenderById($tender_id): array
  97.     {
  98.         $queryBuilder $this->createQueryBuilder('t')
  99.             ->andWhere('t.id = :tender_id')
  100.             ->setParameter('tender_id'$tender_id)
  101.             ->getQuery()->execute();
  102.         return $queryBuilder;
  103.     }
  104. }