Update and delete multi timesheets and tags (#1240)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user