Feat: Make some entities soft-deletable

This commit is contained in:
Björn Fromme committed 2023-10-20 17:17:21 +02:00
1 parent 168a69c103
commit d7bbb4bb29
27 files changed
+213 -63

No files matched your search

+8 -39
View File
@@ -21,46 +21,15 @@ class FeeRepository extends ServiceEntityRepository
parent::__construct($registry, Fee::class);
}
public function save(Fee $entity, bool $flush = false): void
public function getList(): array
{
$this->getEntityManager()->persist($entity);
$qb = $this->createQueryBuilder('fee');
if ($flush) {
$this->getEntityManager()->flush();
}
return $qb
->where($qb->expr()->isNull('fee.deletedAt'))
->orderBy('fee.name', 'ASC')
->getQuery()
->getResult()
;
}
public function remove(Fee $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Fee[] Returns an array of Fee objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('f')
// ->andWhere('f.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('f.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Fee
// {
// return $this->createQueryBuilder('f')
// ->andWhere('f.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}