Error stack trace in MVC

1

I use model view controller (MVC) and I have this error in the route sheet (routes.php):

Fatal error: Uncaught Error: Class 'ArticuloController' not found in C: \ xampp \ htdocs \ gestionweb \ routes.php: 37 Stack trace: # 0 C: \ xampp \ htdocs \ gestionweb \ index.php (27): call ('ticket', 'index') # 1 {main} thrown in C: \ xampp \ htdocs \ gestionweb \ routes.php on line 37

code:

<?php

	//función que llama al controlador y su respectiva acción, que son pasados como parámetros
	function call($controller, $action){
		//importa el controlador desde la carpeta Controllers
		require_once('controllers/' . $controller . '_controller.php');

		//crea el controlador
		switch($controller){
			case 'cliente':
				require_once('Models/claseCliente.php');
				$controller= new ClienteController();
                        switch($action){
        
                                        case 'index':
                                        $controller->index();
                                        break;
                                        case 'registrar':
                                        $controller->register();
        
        
	                                   }
                                       break;
            case 'ticket':
                require_once('Models/claseTicket.php');
                $controllerTicket=new TicketController();
                    switch($action){
                        
                            case 'index':
                                $controllerTicket->index();
                                break;
                            case 'buscar':
                                $controllerTicket->buscar();
                    }
            case 'articulo':
            require_once('Models/claseProducto.php');
                $controllerArt= new ArticuloController();
                switch($action){
                        
                            case 'index':
                                $controllerArt->index();
                                break;
                            case 'buscar':
                                $controllerArt->buscar();
                    }
			}
           
	
	
    }
?>

The error is given when entering the ticket index, apparently it calls the article index although it should not, if I enter the article index it is perfect.

But I do not know what a stack trace is.

Thanks

    
asked by Caruso 08.09.2018 в 20:11
source

1 answer

1

I was missing a break, I just realized:

<?php

	//función que llama al controlador y su respectiva acción, que son pasados como parámetros
	function call($controller, $action){
		//importa el controlador desde la carpeta Controllers
		require_once('controllers/' . $controller . '_controller.php');

		//crea el controlador
		switch($controller){
			case 'cliente':
				require_once('Models/claseCliente.php');
				$controller= new ClienteController();
                        switch($action){
        
                                        case 'index':
                                        $controller->index();
                                        break;
                                        case 'registrar':
                                        $controller->register();
        
        
	                                   }
                                       break;
            case 'ticket':
                require_once('Models/claseTicket.php');
                $controllerTicket=new TicketController();
                    switch($action){
                        
                            case 'index':
                                $controllerTicket->index();
                                break;
                            case 'buscar':
                                $controllerTicket->buscar();
                    }
    break;
            case 'articulo':
            require_once('Models/claseProducto.php');
                $controllerArt= new ArticuloController();
                switch($action){
                        
                            case 'index':
                                $controllerArt->index();
                                break;
                            case 'buscar':
                                $controllerArt->buscar();
                    }
			}
           
	
	
    }
?>
    
answered by 08.09.2018 в 20:15