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
/
212
/
root
/
proc
/
self
/
root
/
proc
/
70528
/
cwd
/
src
/
Repository
/
//proc/212/root/proc/212/root/proc/self/root/proc/70528/cwd/src/Repository/CartRepository.php
<?php namespace App\Repository; use App\Entity\Cart; use App\Entity\User; use Doctrine\Persistence\ManagerRegistry; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; /** * @extends ServiceEntityRepository<Cart> * * @method Cart|null find($id, $lockMode = null, $lockVersion = null) * @method Cart|null findOneBy(array $criteria, array $orderBy = null) * @method Cart[] findAll() * @method Cart[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ class CartRepository extends ServiceEntityRepository { public function __construct(ManagerRegistry $registry) { parent::__construct($registry, Cart::class); } public function add(Cart $entity, bool $flush = false): void { $this->getEntityManager()->persist($entity); if ($flush) { $this->getEntityManager()->flush(); } } public function remove(Cart $entity, bool $flush = false): void { $this->getEntityManager()->remove($entity); if ($flush) { $this->getEntityManager()->flush(); } } public function findActiveUserCart($userId){ return $this->createQueryBuilder("c") ->where("c.payementStatus = :status") ->setParameter("status", 'to_be_started') ->andWhere("c.user = :user") ->setParameter("user", $userId) ->getQuery() ->getResult(); } public function findOldUserCarts(User $user, Cart $cart){ return $this->createQueryBuilder("c") ->where("c.user = :userId") ->setParameter("userId", $user->getId()) ->andWhere("c.expiresAt < :expiresAt") ->setParameter("expiresAt", $cart->getExpiresAt()) ->andWhere("c.step = 'delivery'") ->andWhere("c.payementStatus != 'waiting_for_transfer'") ->andWhere("c.payementStatus != 'finished'") ->getQuery() ->getResult(); } // /** // * @return Cart[] Returns an array of Cart objects // */ // public function findByExampleField($value): array // { // return $this->createQueryBuilder('c') // ->andWhere('c.exampleField = :val') // ->setParameter('val', $value) // ->orderBy('c.id', 'ASC') // ->setMaxResults(10) // ->getQuery() // ->getResult() // ; // } // public function findOneBySomeField($value): ?Cart // { // return $this->createQueryBuilder('c') // ->andWhere('c.exampleField = :val') // ->setParameter('val', $value) // ->getQuery() // ->getOneOrNullResult() // ; // } }