Worvast
Worvast

Reputation: 279

PHPExcel Bundle in Symfony2: Declaration of PHPExcel_Style_Color error

I install this bundle:

https://github.com/liuggio/ExcelBundle

In my Symfony2, basically add:

[PHPExcel]
    git=http://github.com/PHPOffice/PHPExcel.git
    target=/phpexcel
    version=origin/master

[n3bStreamresponse]
    git=git://github.com/liuggio/Symfony2-StreamResponse.git
    target=n3b/src/n3b/Bundle/Util/HttpFoundation/StreamResponse

[LiuggioExcelBundle]
    git=https://github.com/liuggio/ExcelBundle.git
   target=/bundles/Liuggio/ExcelBundle

to deps, update Autoload.php and AppKernel.php and use this Action in one controller:

   $excelService = $this->get('xls.service_xls2007');
   $excelService->excelObj->getProperties()
                        ->setTitle("Reunión comercial")
                        ->setDescription("Reunión Comercial - Generación automática desde la aplicación de RRHH.");

       $excelService->excelObj->getActiveSheet()->setTitle('Reunión Comercial');
       // Set active sheet index to the first sheet, so Excel opens this as the first sheet
       $excelService->excelObj->setActiveSheetIndex(0);

   //create the response
   $response = $excelService->getResponse();
   $response->headers->set('Content-Type', 'text/vnd.ms-excel; charset=utf-8');
   $response->headers->set('Content-Disposition', 'attachment;filename=reuComercial-'.date("Y_m_d_His").'.xls');

   // If you are using a https connection, you have to set those two headers for compatibility with IE <9
   /*$response->headers->set('Pragma', 'public');
   $response->headers->set('Cache-Control', 'maxage=1');
   */
   $excelService->setActiveSheetIndex(0)
        ->setCellValue('A1', 'Lead')
          ->setCellValue('B1', 'Peticion')
          ->setCellValue('C1', 'Estado Candidato')
          ->setCellValue('D1', 'Nombre Candidato')
          ->setCellValue('E1', 'Apellido Candidato')
          ->setCellValue('F1', 'Cliente')
          ->setCellValue('G1', 'Descripcion');


   $em = $this->getDoctrine()->getEntityManager();

   $data = $em->getRepository('OportunidadBundle:Oportunidad')->reunionComercial();

   $aux = 2;
   foreach ($data as $row)
   {
      $excelService->setActiveSheetIndex(0)
          ->setCellValue('A'.$aux, $row->Lead)
          ->setCellValue('B'.$aux, $row->Peticion)
          ->setCellValue('C'.$aux, $row->Estado_Candidato)
          ->setCellValue('D'.$aux, $row->Nombre_Candidato)
          ->setCellValue('E'.$aux, $row->Apellido_Candidato)
          ->setCellValue('F'.$aux, $row->Cliente)
          ->setCellValue('G'.$aux, $row->Descripcion);
      $aux++;
   };

   $excelService->getStreamWriter()->write( $filename );

   return $response;   

And I get this error :(

Runtime Notice: Declaration of PHPExcel_Style_Color::bindParent() should be compatible with that of PHPExcel_Style_Supervisor::bindParent() in C:\Program Files\EasyPHP-5.3.8.1\www\www\www\intranet\vendor\phpexcel\Classes\PHPExcel\Style\Color.php line 36

I have no idea what this means, because there are many things in PHP that still escape me :/

Upvotes: 0

Views: 2330

Answers (1)

Mark Baker
Mark Baker

Reputation: 212412

It's a problem with pulling the latest development branch code rather than tagged releases: develop branch code is never guaranteed to be in a state where you can simply run it.

I've modified the signatures for the bindParent() method so that this particular notice won't occur again

Upvotes: 1

Related Questions