› Foros › PC › Software libre
<?php
namespace MDW\logisticaBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
//include_once("C:\wamp\www\prueba\clases\database.php");
?>
<?php
class DefaultController extends Controller
{
public function indexAction($name)
{
return $this->render('MDWlogisticaBundle:Default:index.html.twig', array('name' => $name));
}
public function articulosAction()
{
//-- Simulamos obtener los datos de la base de datos cargando los artículos a un array
$db=new database();
$db->conectar();
$articulos = array(
array('id' => 1, 'title' => 'Articulo numero 1', 'created' => '2011-01-01'),
array('id' => 2, 'title' => 'Articulo numero 2', 'created' => '2011-01-01'),
array('id' => 3, 'title' => 'Articulo numero 3', 'created' => '2011-01-01'),
);
return $this->render('MDWlogisticaBundle:Default:articulos.html.twig', array('articulos' => $articulos));
}
public function articuloAction($id)
{
//-- Simulamos obtener los datos de la base de datos cargando los artículos a un array
$articulos = array(
array('id' => 1, 'title' => 'Articulo numero 1', 'created' => '2011-01-01'),
array('id' => 2, 'title' => 'Articulo numero 2', 'created' => '2011-01-01'),
array('id' => 3, 'title' => 'Articulo numero 3', 'created' => '2011-01-01'),
);
//-- Buscamos dentro del array el ID solicitado
$articuloSeleccionado = null;
foreach($articulos as $articulo)
{
if($articulo['id'] == $id)
{
$articuloSeleccionado = $articulo;
break;
}
}
//-- Invocamos a nuestra nueva plantilla, pasando los datos
return $this->render('MDWlogisticaBundle:Default:articulo.html.twig', array('articulo' => $articuloSeleccionado));
}
}
The autoloader expected class "MDW\logisticaBundle\Controller\database" to be defined in file "C:\wamp\www\prueba/src/\MDW\logisticaBundle\Controller\database.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
500 Internal Server Error - RuntimeException