WIP: Implement admin CRUD

This commit is contained in:
Björn Fromme committed 2023-09-26 17:44:01 +02:00
1 parent 3e0353c79b
commit c55fd85314
63 files changed
+1367 -532

No files matched your search

+9 -39
View File
@@ -21,46 +21,16 @@ class TrainingRepository extends ServiceEntityRepository
parent::__construct($registry, Training::class);
}
public function save(Training $entity, bool $flush = false): void
public function getList(): array
{
$this->getEntityManager()->persist($entity);
$qb = $this->createQueryBuilder('training');
if ($flush) {
$this->getEntityManager()->flush();
}
return $qb
->select('training', 'training_attendance')
->leftJoin('training.trainingAttendances', 'training_attendance')
->orderBy('training.name', 'ASC')
->getQuery()
->getResult()
;
}
public function remove(Training $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Training[] Returns an array of Training objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('t')
// ->andWhere('t.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('t.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?Training
// {
// return $this->createQueryBuilder('t')
// ->andWhere('t.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}