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 JobProfileRepository extends ServiceEntityRepository
parent::__construct($registry, JobProfile::class);
}
public function save(JobProfile $entity, bool $flush = false): void
public function getList(): array
{
$this->getEntityManager()->persist($entity);
$qb = $this->createQueryBuilder('job_profile');
if ($flush) {
$this->getEntityManager()->flush();
}
return $qb
->select('job_profile', 'required_training')
->leftJoin('job_profile.requiredTraining', 'required_training')
->orderBy('job_profile.name', 'ASC')
->getQuery()
->getResult()
;
}
public function remove(JobProfile $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return JobProfile[] Returns an array of JobProfile objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('j')
// ->andWhere('j.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('j.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?JobProfile
// {
// return $this->createQueryBuilder('j')
// ->andWhere('j.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}
+7 -39
View File
@@ -4,6 +4,7 @@ namespace App\Repository;
use App\Entity\Teamer;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\Persistence\ManagerRegistry;
/**
@@ -21,46 +22,13 @@ class TeamerRepository extends ServiceEntityRepository
parent::__construct($registry, Teamer::class);
}
public function save(Teamer $entity, bool $flush = false): void
public function getListQuery(): Query
{
$this->getEntityManager()->persist($entity);
$qb = $this->createQueryBuilder('teamer');
if ($flush) {
$this->getEntityManager()->flush();
}
return $qb
->select('teamer', 'user')
->leftJoin('teamer.user', 'user')
->getQuery();
}
public function remove(Teamer $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Teamer[] Returns an array of Teamer 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): ?Teamer
// {
// return $this->createQueryBuilder('t')
// ->andWhere('t.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}
+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()
// ;
// }
}