src/Slashworks/AppBundle/Command/ApiCommand.php
private function _sendErrorNotification(&$oRemoteApp, $aResponse)
        {

            $iStatusCode = $aResponse['statuscode'];
            /*
             * Parse template by statuscode
             */
            if ($iStatusCode === 404) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_404_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } elseif ($iStatusCode === 500) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_500_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } elseif ($iStatusCode === 403) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_403_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } else {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            }

            // translate Subject
            $sSubject = $this->getContainer()->get('translator')->trans('system.email.error.' . $iStatusCode . '.subject');

            // get recipients and sender
            $sRecipient = $oRemoteApp->getNotificationRecipient();
            $sSender    = $oRemoteApp->getNotificationSender();
            $sMessage   = \Swift_Message::newInstance()->setSubject($sSubject)->setFrom($sSender)->setTo($sRecipient)->setContentType('text/html')->setBody($sHtml, 'text/html')->addPart($sHtml, 'text/html');

            // send notification
            $this->getContainer()->get('mailer')->send($sMessage);
        }
private function _sendErrorNotification(&$oRemoteApp, $aResponse)
        {

            $iStatusCode = $aResponse['statuscode'];
            /*
             * Parse template by statuscode
             */
            if ($iStatusCode === 404) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_404_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } elseif ($iStatusCode === 500) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_500_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } elseif ($iStatusCode === 403) {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_403_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            } else {
                $sHtml = $this->getContainer()->get('templating')->render('SlashworksAppBundle:Email:cron_error_notification.html.twig', array(
                    'remote_app' => $oRemoteApp,
                    'response'   => $aResponse,
                    'controlurl' => $this->_getSiteURL()
                ));
            }

            // translate Subject
            $sSubject = $this->getContainer()->get('translator')->trans('system.email.error.' . $iStatusCode . '.subject');

            // get recipients and sender
            $sRecipient = $oRemoteApp->getNotificationRecipient();
            $sSender    = $oRemoteApp->getNotificationSender();
            $sMessage   = \Swift_Message::newInstance()->setSubject($sSubject)->setFrom($sSender)->setTo($sRecipient)->setContentType('text/html')->setBody($sHtml, 'text/html')->addPart($sHtml, 'text/html');

            // send notification
            $this->getContainer()->get('mailer')->send($sMessage);
        }
private function _sendErrorNotification ( & $ oRemoteApp , $ aResponse ) { $ iStatusCode = $ aResponse [ 'statuscode' ] ; /*
             * Parse template by statuscode
             */ if ( $ iStatusCode === 404 ) { $ sHtml = $ this -> getContainer ( ) -> get ( 'templating' ) -> render ( 'SlashworksAppBundle:Email:cron_error_404_notification.html.twig' , array ( 'remote_app' => $ oRemoteApp , 'response' => $ aResponse , 'controlurl' => $ this -> _getSiteURL ( ) ) ) ; } elseif ( $ iStatusCode === 500 ) { $ sHtml = $ this -> getContainer ( ) -> get ( 'templating' ) -> render ( 'SlashworksAppBundle:Email:cron_error_500_notification.html.twig' , array ( 'remote_app' => $ oRemoteApp , 'response' => $ aResponse , 'controlurl' => $ this -> _getSiteURL ( ) ) ) ; } elseif ( $ iStatusCode === 403 ) { $ sHtml = $ this -> getContainer ( ) -> get ( 'templating' ) -> render ( 'SlashworksAppBundle:Email:cron_error_403_notification.html.twig' , array ( 'remote_app' => $ oRemoteApp , 'response' => $ aResponse , 'controlurl' => $ this -> _getSiteURL ( ) ) ) ; } else { $ sHtml = $ this -> getContainer ( ) -> get ( 'templating' ) -> render ( 'SlashworksAppBundle:Email:cron_error_notification.html.twig' , array ( 'remote_app' => $ oRemoteApp , 'response' => $ aResponse , 'controlurl' => $ this -> _getSiteURL ( ) ) ) ; } // translate Subject $ sSubject = $ this -> getContainer ( ) -> get ( 'translator' ) -> trans ( 'system.email.error.' . $ iStatusCode . '.subject' ) ; // get recipients and sender $ sRecipient = $ oRemoteApp -> getNotificationRecipient ( ) ; $ sSender = $ oRemoteApp -> getNotificationSender ( ) ; $ sMessage = \ Swift_Message :: newInstance ( ) -> setSubject ( $ sSubject ) -> setFrom ( $ sSender ) -> setTo ( $ sRecipient ) -> setContentType ( 'text/html' ) -> setBody ( $ sHtml , 'text/html' ) -> addPart ( $ sHtml , 'text/html' ) ; // send notification $ this -> getContainer ( ) -> get ( 'mailer' ) -> send ( $ sMessage ) ; }
Send Error-Notification to user

@param $oRemoteApp
@param $aResponse
Send Error - Notification to user