public function exportAction()
    {
        $applicationCanonicalName = $this->get('canal_tp_sam.application.finder')->getCurrentApp()->getCanonicalName();
        $externalCoverageId = $this->getUser()->getCustomer()->getPerimeters()->first()->getExternalCoverageId();
        $calendars = $this->getDoctrine()->getRepository('CanalTPMttBundle:Calendar')->findCalendarByExternalCoverageIdAndApplication($externalCoverageId, $applicationCanonicalName);

        try {
            $calendarExport = $this->get('canal_tp_mtt.calendar_export');
            $response = $calendarExport->export($externalCoverageId, $calendars);

            if (!$response->isSuccessful()) {
                throw new \RuntimeException($this->getMessageFromResponse($response));
            }

            $flashType  = 'success';
            $message = $this->getMessageFromResponse($response);
        } catch (\Exception $ex) {
            $flashType  = 'danger';
            $message = $ex->getMessage();
        }

        $this->addFlash($flashType, $message);

        return $this->redirectToRoute('canal_tp_mtt_calendars_list');
    }
public function exportAction()
    {
        $applicationCanonicalName = $this->get('canal_tp_sam.application.finder')->getCurrentApp()->getCanonicalName();
        $externalCoverageId = $this->getUser()->getCustomer()->getPerimeters()->first()->getExternalCoverageId();
        $calendars = $this->getDoctrine()->getRepository('CanalTPMttBundle:Calendar')->findCalendarByExternalCoverageIdAndApplication($externalCoverageId, $applicationCanonicalName);

        try {
            $calendarExport = $this->get('canal_tp_mtt.calendar_export');
            $response = $calendarExport->export($externalCoverageId, $calendars);

            if (!$response->isSuccessful()) {
                throw new \RuntimeException($this->getMessageFromResponse($response));
            }

            $flashType  = 'success';
            $message = $this->getMessageFromResponse($response);
        } catch (\Exception $ex) {
            $flashType  = 'danger';
            $message = $ex->getMessage();
        }

        $this->addFlash($flashType, $message);

        return $this->redirectToRoute('canal_tp_mtt_calendars_list');
    }
public function exportAction ( ) { $ applicationCanonicalName = $ this -> get ( 'canal_tp_sam.application.finder' ) -> getCurrentApp ( ) -> getCanonicalName ( ) ; $ externalCoverageId = $ this -> getUser ( ) -> getCustomer ( ) -> getPerimeters ( ) -> first ( ) -> getExternalCoverageId ( ) ; $ calendars = $ this -> getDoctrine ( ) -> getRepository ( 'CanalTPMttBundle:Calendar' ) -> findCalendarByExternalCoverageIdAndApplication ( $ externalCoverageId , $ applicationCanonicalName ) ; try { $ calendarExport = $ this -> get ( 'canal_tp_mtt.calendar_export' ) ; $ response = $ calendarExport -> export ( $ externalCoverageId , $ calendars ) ; if ( ! $ response -> isSuccessful ( ) ) { throw new \ RuntimeException ( $ this -> getMessageFromResponse ( $ response ) ) ; } $ flashType = 'success' ; $ message = $ this -> getMessageFromResponse ( $ response ) ; } catch ( \ Exception $ ex ) { $ flashType = 'danger' ; $ message = $ ex -> getMessage ( ) ; } $ this -> addFlash ( $ flashType , $ message ) ; return $ this -> redirectToRoute ( 'canal_tp_mtt_calendars_list' ) ; }
Export a zip with calendars

@return Response
Export a zip with calendars