mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
final touches to controller
This commit is contained in:
parent
ef84576903
commit
9c428f989c
@ -113,51 +113,32 @@ class ReassignAccompanyingPeriodController extends AbstractController
|
||||
|
||||
$assignForm->handleRequest($request);
|
||||
|
||||
$userFromId = null !== $userFrom ? $userFrom->getId() : null;
|
||||
dump($userFrom);
|
||||
if ($assignForm->isSubmitted()) {
|
||||
dump(' assign submitted');
|
||||
|
||||
|
||||
if ($assignForm->isSubmitted()) {
|
||||
dump('reassign');
|
||||
|
||||
$assignPeriodIds = json_decode($assignForm->get('periods')->getData(), true);
|
||||
$userTo = $assignForm->get('userTo')->getData();
|
||||
$userFrom = $assignForm->get('userFrom')->getData();
|
||||
|
||||
$i = 0;
|
||||
|
||||
dump($assignPeriodIds);
|
||||
|
||||
foreach($assignPeriodIds as $periodId) {
|
||||
$period = $this->courseRepository->find($periodId);
|
||||
|
||||
|
||||
if ($userFrom === $period->getUser()) {
|
||||
$period->setUser($userTo);
|
||||
}
|
||||
|
||||
|
||||
if ($i === 10) {
|
||||
// dd($i);
|
||||
}
|
||||
|
||||
dump($period);
|
||||
$i++;
|
||||
}
|
||||
|
||||
//$this->em->flush();
|
||||
|
||||
|
||||
$this->em->flush();
|
||||
|
||||
// redirect to the first page
|
||||
|
||||
return $this->redirectToRoute('chill_course_list_reassign', [
|
||||
'form' => ['user' => $userFrom->getId()],
|
||||
]);
|
||||
|
||||
}
|
||||
} else {
|
||||
dump('no assign form');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return new Response(
|
||||
$this->engine->render('@ChillPerson/AccompanyingPeriod/reassign_list.html.twig', [
|
||||
'paginator' => $paginator,
|
||||
|
Loading…
x
Reference in New Issue
Block a user