Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/04/2014, 07:26
Avatar de hhs
hhs
Colaborador
 
Fecha de Ingreso: junio-2013
Ubicación: México
Mensajes: 2.995
Antigüedad: 10 años, 10 meses
Puntos: 379
Respuesta: Comrobar la existencia de una planrilla twig

puedes hacerlo asi:
Código PHP:
Ver original
  1. if($this->get('templating')->exist('Bundle:Controller:plantilla.twig'))
  2. {
  3.    //aqui tu codigo
  4. }

o lo puedes hacer con try/catch:

Código PHP:
Ver original
  1. try {
  2.       $this->render('Bundle:Controller:bar.html.twig')
  3.   } catch (\Exception $ex) {
  4.      // Manejas la excepción
  5. }
__________________
Saludos
About me
Laraveles
A class should have only one reason to change.