Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/04/2014, 04:25
Avatar de Did_Web
Did_Web
 
Fecha de Ingreso: junio-2007
Ubicación: El vendrell (Tarragona)
Mensajes: 52
Antigüedad: 16 años, 11 meses
Puntos: 0
Respuesta: Instanciar objeto mediante variable

Ok ya lo he solucionado.

Estoy sobre Symfony2 y el problema me lo daba los namespace lo he solucionado así:


Código PHP:
    public function formulario($entidad)
    {
        
$Mayentidad     'Gestor\CrudBundle\Entity\\'.ucwords($entidad);
        
$MayentidadType    'Gestor\CrudBundle\Form\\'.ucwords($entidad).'Type';
        
        
$LaEntidad = new $Mayentidad();
        
$form   $this->createForm(new $MayentidadType(), $LaEntidad);
        
        return 
$form;
    }