51 lines
1.3 KiB
PHP
51 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()
|
||
|
;
|
||
|
}
|
||
|
*/
|
||
|
}
|