Feat: Make some entities soft-deletable
This commit is contained in:
1 parent
168a69c103
commit
d7bbb4bb29
27 files changed
+213
-63
No files matched your search
@@ -32,6 +32,7 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
->select('assignment', 'destination', 'job_profile', 'application', 'disposition')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->where($qb->expr()->isNull('assignment.deletedAt'))
|
||||
;
|
||||
|
||||
if (null !== $teamer) {
|
||||
@@ -61,6 +62,7 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
->innerJoin('assignment.teamers', 'teamer', Join::WITH, 'teamer = :teamer')
|
||||
->leftJoin('assignment.applications', 'application', Join::WITH, 'application.teamer = :teamer')
|
||||
->leftJoin('assignment.dispositions', 'disposition', Join::WITH, 'disposition.teamer = :teamer')
|
||||
->where($qb->expr()->isNull('assignment.deletedAt'))
|
||||
->setParameter('teamer', $teamer)
|
||||
;
|
||||
|
||||
@@ -76,6 +78,7 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
$result = $qb
|
||||
->select('MIN(destination.dateFrom) minDate', 'MAX(destination.dateTo) maxDate')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->where($qb->expr()->isNull('assignment.deletedAt'))
|
||||
->getQuery()
|
||||
->getSingleResult()
|
||||
;
|
||||
@@ -89,6 +92,7 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
->select('job_profile.id', 'job_profile.name')
|
||||
->innerJoin('assignment.jobProfile', 'job_profile')
|
||||
->orderBy('job_profile.name', 'ASC')
|
||||
->where($qb->expr()->isNull('assignment.deletedAt'))
|
||||
->getQuery()
|
||||
->getArrayResult()
|
||||
;
|
||||
@@ -102,6 +106,7 @@ class AssignmentRepository extends ServiceEntityRepository
|
||||
$result = $qb
|
||||
->select('destination.id id', 'destination.product product', 'destination.hotel hotel')
|
||||
->innerJoin('assignment.destination', 'destination')
|
||||
->where($qb->expr()->isNull('assignment.deletedAt'))
|
||||
->orderBy('destination.product', 'ASC')
|
||||
->groupBy('destination.id')
|
||||
->getQuery()
|
||||
|
||||
@@ -30,7 +30,8 @@ class AvailabilityRepository extends ServiceEntityRepository
|
||||
return $qb
|
||||
->where($qb->expr()->andX(
|
||||
$qb->expr()->gt('availability.dateFrom', ':today'),
|
||||
$qb->expr()->isNull('availability.owner')
|
||||
$qb->expr()->isNull('availability.owner'),
|
||||
$qb->expr()->isNull('availability.deletedAt')
|
||||
))
|
||||
->orderBy('availability.dateFrom', 'ASC')
|
||||
->setParameter('today', new \DateTimeImmutable())
|
||||
@@ -53,7 +54,8 @@ class AvailabilityRepository extends ServiceEntityRepository
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->isNull('availability.owner'),
|
||||
$qb->expr()->eq('availability.owner', ':owner')
|
||||
)
|
||||
),
|
||||
$qb->expr()->isNull('availability.deletedAt')
|
||||
))
|
||||
->orderBy('availability.dateFrom', 'ASC')
|
||||
->setParameter('teamer', $teamer)
|
||||
|
||||
@@ -29,12 +29,16 @@ class DestinationRepository extends ServiceEntityRepository
|
||||
$qb = $this->createQueryBuilder('destination');
|
||||
|
||||
$dates = $qb
|
||||
->where($qb->expr()->orX(
|
||||
$qb->expr()->like('destination.product', ':search'),
|
||||
$qb->expr()->like('destination.hotel', ':search'),
|
||||
$qb->expr()->like('DATE_FORMAT(destination.dateFrom, \'%d.%m.%y\')', ':search'),
|
||||
$qb->expr()->like('DATE_FORMAT(destination.dateTo, \'%d.%m.%y\')', ':search')
|
||||
))
|
||||
->where(
|
||||
$qb->expr()->andX(
|
||||
$qb->expr()->isNull('destination.deletedAt'),
|
||||
$qb->expr()->orX(
|
||||
$qb->expr()->like('destination.product', ':search'),
|
||||
$qb->expr()->like('destination.hotel', ':search'),
|
||||
$qb->expr()->like('DATE_FORMAT(destination.dateFrom, \'%d.%m.%y\')', ':search'),
|
||||
$qb->expr()->like('DATE_FORMAT(destination.dateTo, \'%d.%m.%y\')', ':search')
|
||||
))
|
||||
)
|
||||
->setParameter('search', '%'.$this->escapeLikeWildcards($search).'%')
|
||||
->orderBy('destination.dateFrom', 'ASC')
|
||||
->addOrderBy('destination.product', 'ASC')
|
||||
|
||||
@@ -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()
|
||||
// ;
|
||||
// }
|
||||
}
|
||||
@@ -28,6 +28,7 @@ class JobProfileRepository extends ServiceEntityRepository
|
||||
return $qb
|
||||
->select('job_profile', 'required_training')
|
||||
->leftJoin('job_profile.requiredTrainings', 'required_training')
|
||||
->where($qb->expr()->isNull('job_profile.deletedAt'))
|
||||
->orderBy('job_profile.name', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
|
||||
@@ -28,6 +28,7 @@ class TrainingRepository extends ServiceEntityRepository
|
||||
return $qb
|
||||
->select('training', 'training_attendance')
|
||||
->leftJoin('training.trainingAttendances', 'training_attendance')
|
||||
->where($qb->expr()->isNull('training.deletedAt'))
|
||||
->orderBy('training.name', 'ASC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
|
||||
Reference in new issue
Block a user