Controller/MailController.php
public function deleteLog(Request $request, $mailLog)
    {
        // Not Found
        if (null === $mailLog && !$request->request->has('id')) {
            $this->addFlash('error', 'sorry_not_existing');

            return $this->redirectToRoute('admin_mail_logger');
        }

        // Convert Array
        $mailLog = $request->request->has('id') ? $request->request->get('id') : [$mailLog];

        // Remove Mail Log
        if ($mailLog) {
            $em = $this->getDoctrine()->getManager();
            $em->createQueryBuilder('')
                ->delete($this->getParameter('pd_mailer.mail_log_class'), 'log')
                ->add('where', $em->getExpressionBuilder()->in('log.id', ':logId'))
                ->setParameter(':logId', $mailLog)
                ->getQuery()
                ->execute();
        }

        // Redirect Back
        return $this->redirect($request->headers->get('referer') ?? $this->generateUrl('admin_mail_logger'));
    }
public function deleteLog(Request $request, $mailLog)
    {
        // Not Found
        if (null === $mailLog && !$request->request->has('id')) {
            $this->addFlash('error', 'sorry_not_existing');

            return $this->redirectToRoute('admin_mail_logger');
        }

        // Convert Array
        $mailLog = $request->request->has('id') ? $request->request->get('id') : [$mailLog];

        // Remove Mail Log
        if ($mailLog) {
            $em = $this->getDoctrine()->getManager();
            $em->createQueryBuilder('')
                ->delete($this->getParameter('pd_mailer.mail_log_class'), 'log')
                ->add('where', $em->getExpressionBuilder()->in('log.id', ':logId'))
                ->setParameter(':logId', $mailLog)
                ->getQuery()
                ->execute();
        }

        // Redirect Back
        return $this->redirect($request->headers->get('referer') ?? $this->generateUrl('admin_mail_logger'));
    }
public function deleteLog ( Request $ request , $ mailLog ) { // Not Found if ( null === $ mailLog && ! $ request -> request -> has ( 'id' ) ) { $ this -> addFlash ( 'error' , 'sorry_not_existing' ) ; return $ this -> redirectToRoute ( 'admin_mail_logger' ) ; } // Convert Array $ mailLog = $ request -> request -> has ( 'id' ) ? $ request -> request -> get ( 'id' ) : [ $ mailLog ] ; // Remove Mail Log if ( $ mailLog ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> createQueryBuilder ( '' ) -> delete ( $ this -> getParameter ( 'pd_mailer.mail_log_class' ) , 'log' ) -> add ( 'where' , $ em -> getExpressionBuilder ( ) -> in ( 'log.id' , ':logId' ) ) -> setParameter ( ':logId' , $ mailLog ) -> getQuery ( ) -> execute ( ) ; } // Redirect Back return $ this -> redirect ( $ request -> headers -> get ( 'referer' ) ?? $ this -> generateUrl ( 'admin_mail_logger' ) ) ; }
Delete Logs.

@param Request $request
@param $mailLog

@IsGranted("ROLE_MAIL_LOGDELETE")

@return \Symfony\Component\HttpFoundation\Response
Delete Logs .