This commit is contained in:
lubiana 2024-02-17 12:30:54 +01:00
parent d30bb74cc5
commit 9e804c6113
6 changed files with 30 additions and 49 deletions

View file

@ -4,6 +4,8 @@ namespace App\Repository;
use App\Entity\ItemExtra;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Persistence\ManagerRegistry;
/**
@ -21,27 +23,12 @@ class ItemExtraRepository extends ServiceEntityRepository
parent::__construct($registry, ItemExtra::class);
}
// /**
// * @return ItemExtra[] Returns an array of ItemExtra objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('i')
// ->andWhere('i.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('i.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?ItemExtra
// {
// return $this->createQueryBuilder('i')
// ->andWhere('i.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
public function getUniqueNames(): Collection
{
$qb = $this->createQueryBuilder('p');
$qb->groupBy('p.name');
return new ArrayCollection($qb->getQuery()->getResult());
}
}