Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
proc
/
212
/
root
/
proc
/
self
/
root
/
proc
/
212
/
root
/
proc
/
70528
/
cwd
/
src
/
Repository
/
//proc/212/root/proc/self/root/proc/212/root/proc/70528/cwd/src/Repository/ProductRepository.php
<?php namespace App\Repository; use App\Entity\Product; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; /** * @extends ServiceEntityRepository<Product> * * @method Product|null find($id, $lockMode = null, $lockVersion = null) * @method Product|null findOneBy(array $criteria, array $orderBy = null) * @method Product[] findAll() * @method Product[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class ProductRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Product::class); } public function add(Product $entity, bool $flush = false): void { $this->getEntityManager()->persist($entity); if ($flush) { $this->getEntityManager()->flush(); } } public function remove(Product $entity, bool $flush = false): void { $this->getEntityManager()->remove($entity); if ($flush) { $this->getEntityManager()->flush(); } } public function findProducts() { return $this->createQueryBuilder("p") ->where("p.active = 1") ->getQuery(); } public function findAllProducts() { return $this->createQueryBuilder("p") ->where("p.active = 1") ->getQuery() ->getResult(); } public function findFromCategory($categoryId, $order) { return $this->createQueryBuilder("p") ->where("p.category = :category") ->andWhere("p.active = 1") ->setParameter(":category", $categoryId) ->getQuery(); } public function findNotFeaturedProducts() { return $this->createQueryBuilder("p") ->where("NOT EXISTS (SELECT f FROM App\\Entity\\FeaturedProduct f WHERE p.id = f.product)") ->andWhere("p.active = 1") ->getQuery() ->getResult(); } public function findQuery($query) { return $this->createQueryBuilder("p") ->where("p.name LIKE :query") ->orWhere("p.description LIKE :query") ->andWhere("p.active = 1") ->setParameter("query", "%$query%") ->getQuery(); } // /** // * @return Product[] Returns an array of Product objects // */ // public function findByExampleField($value): array // { // return $this->createQueryBuilder('p') // ->andWhere('p.exampleField = :val') // ->setParameter('val', $value) // ->orderBy('p.id', 'ASC') // ->setMaxResults(10) // ->getQuery() // ->getResult() // ; // } // public function findOneBySomeField($value): ?Product // { // return $this->createQueryBuilder('p') // ->andWhere('p.exampleField = :val') // ->setParameter('val', $value) // ->getQuery() // ->getOneOrNullResult() // ; // } }