This repository has been archived on 2024-10-16. You can view files and clone it, but cannot push or open issues or pull requests.
pflaenz.li-Symfony/src/Repository/WishRepository.php
2021-05-04 11:52:20 +02:00

50 lines
1.3 KiB
PHP

<?php
namespace App\Repository;
use App\Entity\Wish;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @method Wish|null find($id, $lockMode = null, $lockVersion = null)
* @method Wish|null findOneBy(array $criteria, array $orderBy = null)
* @method Wish[] findAll()
* @method Wish[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class WishRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Wish::class);
}
// /**
// * @return Wish[] Returns an array of Wish objects
// */
public function findByUser($value)
{
return $this->createQueryBuilder('w')
->andWhere('w.byUser = :val')
->setParameter('val', $value)
->orderBy('w.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
/*
public function findOneBySomeField($value): ?Wish
{
return $this->createQueryBuilder('w')
->andWhere('w.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}