Added table for tracking progress of a book.

This commit is contained in:
krzysiej
2022-06-06 15:33:20 +02:00
parent f715f401e1
commit 21743d032c
5 changed files with 216 additions and 9 deletions

View File

@@ -0,0 +1,66 @@
<?php
namespace App\Repository;
use App\Entity\Progress;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Progress>
*
* @method Progress|null find($id, $lockMode = null, $lockVersion = null)
* @method Progress|null findOneBy(array $criteria, array $orderBy = null)
* @method Progress[] findAll()
* @method Progress[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ProgressRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Progress::class);
}
public function add(Progress $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(Progress $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Progress[] Returns an array of Progress 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): ?Progress
// {
// return $this->createQueryBuilder('p')
// ->andWhere('p.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}