Update and delete multi timesheets and tags (#1240)

This commit is contained in:
Kevin Papst
2019-11-15 01:25:31 +01:00
committed by GitHub
parent b4739f8f03
commit 94c28ebbc5
49 changed files with 1836 additions and 307 deletions

View File

@@ -67,6 +67,27 @@ class TimesheetRepository extends EntityRepository
$entityManager->flush();
}
/**
* @param Timesheet[] $timesheets
* @throws \Exception
*/
public function deleteMultiple(iterable $timesheets): void
{
$em = $this->getEntityManager();
$em->beginTransaction();
try {
foreach ($timesheets as $timesheet) {
$em->remove($timesheet);
}
$em->flush();
$em->commit();
} catch (\Exception $ex) {
$em->rollback();
throw $ex;
}
}
/**
* @param Timesheet $timesheet
* @throws \Doctrine\ORM\ORMException
@@ -79,6 +100,27 @@ class TimesheetRepository extends EntityRepository
$entityManager->flush();
}
/**
* @param Timesheet[] $timesheets
* @throws \Exception
*/
public function saveMultiple(array $timesheets): void
{
$em = $this->getEntityManager();
$em->beginTransaction();
try {
foreach ($timesheets as $timesheet) {
$em->persist($timesheet);
}
$em->flush();
$em->commit();
} catch (\Exception $ex) {
$em->rollback();
throw $ex;
}
}
/**
* @param Timesheet $entry
* @return bool