<?php
namespace App\Controller;
use App\Entity\Childs;
use App\Form\ChildsFormType;
use App\Repository\ChildsRepository;
use App\Repository\SessionsRepository;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use Symfony\Component\Security\Core\Security;
use Knp\Component\Pager\PaginatorInterface;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;
use Monolog\DateTimeImmutable;
class ChildsController extends AbstractController
{
private $em;
private $childsRepository;
private $security;
public function __construct(ChildsRepository $childsRepository, EntityManagerInterface $em, Security $security, SessionsRepository $sessionsRepository)
{
$this->childsRepository = $childsRepository;
$this->sessionsRepository = $sessionsRepository;
$this->em = $em;
$this->security = $security;
}
#[Route('/childs', name: 'app_childs')]
public function index(Request $request, PaginatorInterface $paginator): Response
{
$current_user = $this->security->getUser();
$assigned_childs = array();
foreach ($current_user->getChilds() as $value) {
$assigned_childs[] = $value;
}
$filter = $request->query->get('filter');
$status = $request->query->get('status');
$search_term = $request->query->get('q');
//if( !empty($assigned_childs) ){
if( isset($current_user->getRoles()[0]) && $current_user->getRoles()[0] == 'ROLE_STAKEHOLDER' ){
$queryBuilder = $this->childsRepository->findByUser($current_user->getId(), $filter, $search_term, $status);
}else{
if( !empty($filter) ){
$queryBuilder = $this->childsRepository->findAllFilter($filter, $search_term, $status);
}else{
$queryBuilder = $this->childsRepository->findAll($search_term, $status);
}
}
$pagination = $paginator->paginate(
$queryBuilder, /* query NOT result */
$request->query->getInt('page', 1)/*page number*/,
10/*limit per page*/
);
return $this->render('childs/index.html.twig', [
'pagination' => $pagination,
'filter' => $filter,
'status' => $status,
'search_term' => $search_term,
]);
}
#[Route('/notcheck', name: 'app_notcheck')]
public function notcheck(Request $request, PaginatorInterface $paginator): Response
{
$current_user = $this->security->getUser();
$assigned_childs = array();
foreach ($current_user->getChilds() as $value) {
$assigned_childs[] = $value;
}
$filter = $request->query->get('filter');
$status = $request->query->get('status');
$search_term = $request->query->get('q');
//if( !empty($assigned_childs) ){
if( isset($current_user->getRoles()[0]) && $current_user->getRoles()[0] == 'ROLE_STAKEHOLDER' ){
return $this->redirectToRoute('app_childs');
}else{
if( !empty($filter) ){
$queryBuilder = $this->childsRepository->findAllFilter($filter, $search_term, $status);
}else{
$queryBuilder = $this->childsRepository->findAllNotCheck($search_term, $status);
}
}
$pagination = $paginator->paginate(
$queryBuilder, /* query NOT result */
$request->query->getInt('page', 1)/*page number*/,
10/*limit per page*/
);
return $this->render('childs/notcheck.html.twig', [
'pagination' => $pagination,
'filter' => $filter,
'status' => $status,
'search_term' => $search_term,
]);
}
#[Route('/childs/create', name: 'create_childs')]
public function create(Request $request): Response
{
$childs = new Childs();
$form = $this->createForm(ChildsFormType::class, $childs);
$form->handleRequest($request);
if ( $form->isSubmitted() && $form->isValid() ) {
$newChilds = $form->getData();
$imagePath = $form->get('image')->getData();
$fileone = $form->get('fileone')->getData();
$filetwo = $form->get('filetwo')->getData();
$filethree = $form->get('filethree')->getData();
if( $imagePath ){
$newFileName = uniqid() . '.' . $imagePath->guessExtension();
try {
$imagePath->move(
$this->getParameter('kernel.project_dir') . '/public/uploads',
$newFileName
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$newChilds->setImage('uploads/' . $newFileName);
}
if( $fileone ){
$fileone_path = array();
foreach( $fileone as $fileone_single ){
$fileonename = uniqid() . '.' . $fileone_single->guessExtension();
try {
$fileone_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$fileonename
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$fileone_path[] = 'uploads/childfiles/' . $fileonename;
}
$newChilds->setFileone($fileone_path);
}
if( $filetwo ){
$filetwo_path = array();
foreach( $filetwo as $filetwo_single ){
$filetwoname = uniqid() . '.' . $filetwo_single->guessExtension();
try {
$filetwo_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$filetwoname
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$filetwo_path[] = 'uploads/childfiles/' . $filetwoname;
}
$newChilds->setFiletwo($filetwo_path);
}
if( $filethree ){
$filethree_path = array();
foreach( $filethree as $filethree_single ){
$filethreename = uniqid() . '.' . $filethree_single->guessExtension();
try {
$filethree_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$filethreename
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$filethree_path[] = 'uploads/childfiles/' . $filethreename;
}
$newChilds->setFilethree($filethree_path);
}
$current_datetime = new DateTimeImmutable('now');
$newChilds->setCreationdate($current_datetime);
$newChilds->setSessionsemail(0);
$this->em->persist($newChilds);
$this->em->flush();
return $this->redirectToRoute('childs');
}
return $this->render('childs/create.html.twig', [
'form' => $form->createView()
]);
}
// For without login
#[Route('/childs/inscription', name: 'inscription_childs')]
public function inscription(Request $request): Response
{
$childs = new Childs();
$form = $this->createForm(ChildsFormType::class, $childs);
$form->handleRequest($request);
if ( $form->isSubmitted() && $form->isValid() ) {
$newChilds = $form->getData();
$imagePath = $form->get('image')->getData();
$fileone = $form->get('fileone')->getData();
$filetwo = $form->get('filetwo')->getData();
$filethree = $form->get('filethree')->getData();
if( $imagePath ){
$newFileName = uniqid() . '.' . $imagePath->guessExtension();
try {
$imagePath->move(
$this->getParameter('kernel.project_dir') . '/public/uploads',
$newFileName
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$newChilds->setImage('uploads/' . $newFileName);
}
if( $fileone ){
$fileone_path = array();
foreach( $fileone as $fileone_single ){
$fileonename = uniqid() . '.' . $fileone_single->guessExtension();
try {
$fileone_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$fileonename
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$fileone_path[] = 'uploads/childfiles/' . $fileonename;
}
$newChilds->setFileone($fileone_path);
}
if( $filetwo ){
$filetwo_path = array();
foreach( $filetwo as $filetwo_single ){
$filetwoname = uniqid() . '.' . $filetwo_single->guessExtension();
try {
$filetwo_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$filetwoname
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$filetwo_path[] = 'uploads/childfiles/' . $filetwoname;
}
$newChilds->setFiletwo($filetwo_path);
}
if( $filethree ){
$filethree_path = array();
foreach( $filethree as $filethree_single ){
$filethreename = uniqid() . '.' . $filethree_single->guessExtension();
try {
$filethree_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$filethreename
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$filethree_path[] = 'uploads/childfiles/' . $filethreename;
}
$newChilds->setFilethree($filethree_path);
}
$newChilds->setStatus('not_check');
$current_datetime = new DateTimeImmutable('now');
$newChilds->setCreationdate($current_datetime);
$newChilds->setSessionsemail(0);
$this->em->persist($newChilds);
$this->em->flush();
return $this->redirectToRoute('childs');
}
return $this->render('childs/inscription.html.twig', [
'form' => $form->createView()
]);
}
#[Route('/childs/edit/{id}', name: 'edit_child')]
public function edit($id, Request $request): Response
{
$child = $this->childsRepository->find($id);
$current_img = $child->getImage();
$oldStatus = $child->getStatus();
$form = $this->createForm(ChildsFormType::class, $child);
$form->handleRequest($request);
$image = $form->get('image')->getData();
$newStatus = $form->get('status')->getData();
$fileone = $form->get('fileone')->getData();
$filetwo = $form->get('filetwo')->getData();
$filethree = $form->get('filethree')->getData();
if ($form->isSubmitted() && $form->isValid()) {
if ($image) {
if ($child->getImage() !== null) {
if (file_exists(
$this->getParameter('kernel.project_dir') . $child->getImage()
)) {
$this->GetParameter('kernel.project_dir') . $child->getImage();
}
$newFileName = uniqid() . '.' . $image->guessExtension();
try {
$image->move(
$this->getParameter('kernel.project_dir') . '/public/uploads',
$newFileName
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$child->setImage('uploads/' . $newFileName);
}
} else {
$child->setImage($current_img);
}
if( $fileone ){
$fileone_path = array();
foreach( $fileone as $fileone_single ){
$fileonename = uniqid() . '.' . $fileone_single->guessExtension();
try {
$fileone_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$fileonename
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$fileone_path[] = 'uploads/childfiles/' . $fileonename;
}
$child->setFileone($fileone_path);
}
if( $filetwo ){
$filetwo_path = array();
foreach( $filetwo as $filetwo_single ){
$filetwoname = uniqid() . '.' . $filetwo_single->guessExtension();
try {
$filetwo_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$filetwoname
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$filetwo_path[] = 'uploads/childfiles/' . $filetwoname;
}
$child->setFiletwo($filetwo_path);
}
if( $filethree ){
$filethree_path = array();
foreach( $filethree as $filethree_single ){
$filethreename = uniqid() . '.' . $filethree_single->guessExtension();
try {
$filethree_single->move(
$this->getParameter('kernel.project_dir') . '/public/uploads/childfiles',
$filethreename
);
} catch (FileException $e) {
return new Response($e->getMessage());
}
$filethree_path[] = 'uploads/childfiles/' . $filethreename;
}
$child->setFilethree($filethree_path);
}
// Check old status
if( $oldStatus != 'terminé' && $newStatus == 'terminé' ){
$finish_datetime = new DateTimeImmutable('now');
$child->setFinishdate($finish_datetime);
}
$this->em->persist($child);
$this->em->flush();
return $this->redirectToRoute('childs');
}
return $this->render('childs/edit.html.twig', [
'child' => $child,
'form' => $form->createView()
]);
}
#[Route('/childs/sendsessionemail', name: 'send_session_email')]
public function sendsessionemail(MailerInterface $mailer)
{
$childs = $this->childsRepository->findExpired();
if( !empty($childs) ){
foreach($childs as $child){
if( $child->getSessionsemail() == 0 ){
$email = (new Email())
->from('contact@skykeys.fr')
->to('rranveer4@gmail.com')
->subject('Rappel de saisie')
->html('<p>Test email</p>');
$status = $mailer->send($email);
$email = (new Email())
->from('contact@skykeys.fr')
->to('contact@skykeys.fr')
->subject('Rappel de saisie')
->html('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><head><title>Attention ! veuillez mettre a jour le profil de cette enfant a terminer</title></head><body><meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1" name="viewport" />
<meta name="x-apple-disable-message-reformatting" />
<meta content="IE=edge" http-equiv="X-UA-Compatible" />
<meta content="telephone=no" name="format-detection" />
<!--[if (mso 16)]>
<style type="text/css">
a {text-decoration: none;}
</style>
<![endif]--><!--[if gte mso 9]><style>sup { font-size: 100% !important; }</style><![endif]--><!--[if gte mso 9]>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG></o:AllowPNG>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
<![endif]-->
<style type="text/css">
#outlook a {
padding:0;
}
.es-button {
mso-style-priority:100!important;
text-decoration:none!important;
}
a[x-apple-data-detectors] {
color:inherit!important;
text-decoration:none!important;
font-size:inherit!important;
font-family:inherit!important;
font-weight:inherit!important;
line-height:inherit!important;
}
.es-desk-hidden {
display:none;
float:left;
overflow:hidden;
width:0;
max-height:0;
line-height:0;
mso-hide:all;
}
[data-ogsb] .es-button {
border-width:0!important;
padding:10px 30px 10px 30px!important;
}
@media only screen and (max-width:600px) {p, ul li, ol li, a { line-height:150%!important } h1, h2, h3, h1 a, h2 a, h3 a { line-height:120% } h1 { font-size:36px!important; text-align:left } h2 { font-size:26px!important; text-align:left } h3 { font-size:20px!important; text-align:left } .es-header-body h1 a, .es-content-body h1 a, .es-footer-body h1 a { font-size:36px!important; text-align:left } .es-header-body h2 a, .es-content-body h2 a, .es-footer-body h2 a { font-size:26px!important; text-align:left } .es-header-body h3 a, .es-content-body h3 a, .es-footer-body h3 a { font-size:20px!important; text-align:left } .es-menu td a { font-size:12px!important } .es-header-body p, .es-header-body ul li, .es-header-body ol li, .es-header-body a { font-size:14px!important } .es-content-body p, .es-content-body ul li, .es-content-body ol li, .es-content-body a { font-size:16px!important } .es-footer-body p, .es-footer-body ul li, .es-footer-body ol li, .es-footer-body a { font-size:14px!important } .es-infoblock p, .es-infoblock ul li, .es-infoblock ol li, .es-infoblock a { font-size:12px!important } *[class="gmail-fix"] { display:none!important } .es-m-txt-c, .es-m-txt-c h1, .es-m-txt-c h2, .es-m-txt-c h3 { text-align:center!important } .es-m-txt-r, .es-m-txt-r h1, .es-m-txt-r h2, .es-m-txt-r h3 { text-align:right!important } .es-m-txt-l, .es-m-txt-l h1, .es-m-txt-l h2, .es-m-txt-l h3 { text-align:left!important } .es-m-txt-r img, .es-m-txt-c img, .es-m-txt-l img { display:inline!important } .es-button-border { display:inline-block!important } a.es-button, button.es-button { font-size:20px!important; display:inline-block!important } .es-adaptive table, .es-left, .es-right { width:100%!important } .es-content table, .es-header table, .es-footer table, .es-content, .es-footer, .es-header { width:100%!important; max-width:600px!important } .es-adapt-td { display:block!important; width:100%!important } .adapt-img { width:100%!important; height:auto!important } .es-m-p0 { padding:0!important } .es-m-p0r { padding-right:0!important } .es-m-p0l { padding-left:0!important } .es-m-p0t { padding-top:0!important } .es-m-p0b { padding-bottom:0!important } .es-m-p20b { padding-bottom:20px!important } .es-mobile-hidden, .es-hidden { display:none!important } tr.es-desk-hidden, td.es-desk-hidden, table.es-desk-hidden { width:auto!important; overflow:visible!important; float:none!important; max-height:inherit!important; line-height:inherit!important } tr.es-desk-hidden { display:table-row!important } table.es-desk-hidden { display:table!important } td.es-desk-menu-hidden { display:table-cell!important } .es-menu td { width:1%!important } table.es-table-not-adapt, .esd-block-html table { width:auto!important } table.es-social { display:inline-block!important } table.es-social td { display:inline-block!important } .es-m-p5 { padding:5px!important } .es-m-p5t { padding-top:5px!important } .es-m-p5b { padding-bottom:5px!important } .es-m-p5r { padding-right:5px!important } .es-m-p5l { padding-left:5px!important } .es-m-p10 { padding:10px!important } .es-m-p10t { padding-top:10px!important } .es-m-p10b { padding-bottom:10px!important } .es-m-p10r { padding-right:10px!important } .es-m-p10l { padding-left:10px!important } .es-m-p15 { padding:15px!important } .es-m-p15t { padding-top:15px!important } .es-m-p15b { padding-bottom:15px!important } .es-m-p15r { padding-right:15px!important } .es-m-p15l { padding-left:15px!important } .es-m-p20 { padding:20px!important } .es-m-p20t { padding-top:20px!important } .es-m-p20r { padding-right:20px!important } .es-m-p20l { padding-left:20px!important } .es-m-p25 { padding:25px!important } .es-m-p25t { padding-top:25px!important } .es-m-p25b { padding-bottom:25px!important } .es-m-p25r { padding-right:25px!important } .es-m-p25l { padding-left:25px!important } .es-m-p30 { padding:30px!important } .es-m-p30t { padding-top:30px!important } .es-m-p30b { padding-bottom:30px!important } .es-m-p30r { padding-right:30px!important } .es-m-p30l { padding-left:30px!important } .es-m-p35 { padding:35px!important } .es-m-p35t { padding-top:35px!important } .es-m-p35b { padding-bottom:35px!important } .es-m-p35r { padding-right:35px!important } .es-m-p35l { padding-left:35px!important } .es-m-p40 { padding:40px!important } .es-m-p40t { padding-top:40px!important } .es-m-p40b { padding-bottom:40px!important } .es-m-p40r { padding-right:40px!important } .es-m-p40l { padding-left:40px!important } .es-desk-hidden { display:table-row!important; width:auto!important; overflow:visible!important; max-height:inherit!important } }</style>
<div class="es-wrapper-color" style="background-color:#FAFAFA">
<!--[if gte mso 9]>
<v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
<v:fill type="tile" color="#fafafa"></v:fill>
</v:background>
<![endif]-->
<table cellpadding="0" cellspacing="0" class="es-wrapper" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;padding:0;Margin:0;width:100%;height:100%;background-repeat:repeat;background-position:center top;background-color:#FAFAFA" width="100%">
<tbody>
<tr>
<td style="padding:0;Margin:0" valign="top">
<table align="center" cellpadding="0" cellspacing="0" class="es-content" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%">
<tbody>
<tr>
<td align="center" style="padding:0;Margin:0">
<table align="center" bgcolor="#ffffff" cellpadding="0" cellspacing="0" class="es-content-body" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#FFFFFF;width:600px">
<tbody>
<tr>
<td align="left" style="Margin:0;padding-left:20px;padding-right:20px;padding-top:30px;padding-bottom:30px">
<table cellpadding="0" cellspacing="0" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px" width="100%">
<tbody>
<tr>
<td align="center" style="padding:0;Margin:0;width:560px" valign="top">
<table cellpadding="0" cellspacing="0" role="presentation" style="mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px" width="100%">
<tbody>
<tr>
<td align="center" style="padding:0;Margin:0;padding-top:10px;padding-bottom:10px;font-size:0px">
<img alt="" height="45" src="https://suzielc.fr/wp-content/uploads/2021/11/logo2-2048x576.png" style="display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic" width="185" /></td>
</tr>
<tr>
<td align="center" class="es-m-txt-c" style="padding:0;Margin:0;padding-bottom:10px">
<h1 style="Margin:0;line-height:46px;mso-line-height-rule:exactly;font-family:arial, helvetica neue, helvetica, sans-serif;font-size:46px;font-style:normal;font-weight:bold;color:#333333">
Rappel de saisie</h1>
</td>
</tr>
<tr>
<td align="center" class="es-m-p0r es-m-p0l" style="Margin:0;padding-top:5px;padding-bottom:5px;padding-left:40px;padding-right:40px">
<p class="p1" style="margin: 0px; font-variant-numeric: normal; font-variant-east-asian: normal; font-stretch: normal; font-size: 19.5px; line-height: normal; font-family: Helvetica; color: rgb(0, 0, 0);">
<span style="font-size:16px;">Bonjour , lenfant '. $child->getFirstname() .' '. $child->getLastname() .' a dépasser sa date provisoire de fin de session qui été le '. $child->getSessionseta()->format('Y-m-d') .'</span></p>
<p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, helvetica neue, helvetica, sans-serif;line-height:21px;color:#333333;font-size:14px">
<span style="font-size:16px;">Merci de modifer son statut de <strong>En cour </strong> à <strong>Terminer</strong></span></p>
</td>
</tr>
<tr>
<td align="center" style="padding:0;Margin:0;padding-top:10px;padding-bottom:10px">
<span class="es-button-border" style="border-style:solid;border-color:#2CB543;background:#5C68E2;border-width:0px;display:inline-block;border-radius:6px;width:auto"><a class="es-button" href="https://suzielc.com/login" style="mso-style-priority:100 !important;text-decoration:none;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;color:#FFFFFF;font-size:20px;border-style:solid;border-color:#5C68E2;border-width:10px 30px 10px 30px;display:inline-block;background:#5C68E2;border-radius:6px;font-family:arial, helvetica neue, helvetica, sans-serif;font-weight:normal;font-style:normal;line-height:24px;width:auto;text-align:center;border-left-width:30px;border-right-width:30px" target="_blank">Connexion</a></span></td>
</tr>
<tr>
<td align="center" class="es-m-p0r es-m-p0l" style="Margin:0;padding-top:5px;padding-bottom:5px;padding-left:40px;padding-right:40px">
<p style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, helvetica neue, helvetica, sans-serif;line-height:21px;color:#333333;font-size:14px">
Cette email est confidentiel afin de garantir une total securité </p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<br />
</body>');
$status = $mailer->send($email);
$child->setSessionsemail(1);
$this->em->persist($child);
$this->em->flush();
}
}
}
exit();
}
#[Route('/childs/{id}', methods: ['GET'], name: 'show_childs')]
public function show($id): Response
{
$child = $this->childsRepository->find($id);
$school = $child->getSchool()->getName();
return $this->render('childs/show.html.twig', [
'child' => $child,
'school' => $school
]);
}
#[Route('/childs/delete/{id}', methods: ['GET', 'DELETE'], name: 'delete_child')]
public function delete($id): Response
{
$child = $this->childsRepository->find($id);
$sessions = $child->getSessions();
// Get sessions
if( !empty($sessions) ){
foreach($sessions as $session){
$session = $this->sessionsRepository->find($session->getId());
$this->em->remove($session);
$this->em->flush();
}
}
$this->em->remove($child);
$this->em->flush();
return $this->redirectToRoute('childs');
}
}