Implement basic wishlist
This commit is contained in:
parent
d80d667e0d
commit
f2dd4da50b
9 changed files with 315 additions and 0 deletions
50
src/Repository/WishRepository.php
Normal file
50
src/Repository/WishRepository.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?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()
|
||||
;
|
||||
}
|
||||
*/
|
||||
}
|
Reference in a new issue