<?php
namespace App\Crud\Controller;
use App\Crud\Controller\crudController;
/**
* proxyPlainController controller.
*/
class proxyPlainController extends crudController
{
protected function setClassMap($routeClassName)
{
$config = parent::setClassMap($routeClassName);
// $config = $this->container->getParameter('crudmapping');
if (isset($config[$routeClassName]) && isset($config[$routeClassName]['controlador']))
{
$this->classMap['controlador'] = $config[$routeClassName]['controlador'];
}
}
protected function setControlador()
{
if (isset($this->classMap['controlador']))
{
$this->controlador = $this->classMap['controlador'];
}
else
if (!$this->setClassControlador())
{
$this->controlador = 'App\Crud\Controller\crudPlainController';
}
}
protected function setClassControlador()
{
$root = $_SERVER['DOCUMENT_ROOT'];
$fileName = str_replace('/public', '', $root);
$className = $this->classMap['className'];
$fileName = $fileName.'/src/Controller/'.$className.'Controller.php';
if (file_exists($fileName))
{
$this->controlador = 'App\Controller\\'.$className.'Controller';
return true;
}
return false;
}
public function indexAction($rol, $routeClassName)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
return $this->forward($this->controlador.'::indexAction', $this->params);
}
public function newAction($rol, $routeClassName)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
// $this->params['accion'] = $accion;
return $this->forward($this->controlador.'::newAction', $this->params);
}
public function createAction($rol, $routeClassName)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
// $this->params['accion'] = $accion;
return $this->forward($this->controlador.'::createAction', $this->params);
}
public function backToListAction($rol, $routeClassName, $id)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
// $this->params['id'] = $id;
return $this->forward($this->controlador.'::backToListAction', $this->params);
}
public function showAction($rol, $id, $routeClassName, $tab=-1)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
// $this->params['id'] = $id;
$this->params['tab']=$tab;
return $this->forward($this->controlador.'::showAction', $this->params);
}
public function editAction($rol, $id, $routeClassName)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
// $this->params['id'] = $id;
// $this->params['accion'] = $accion;
return $this->forward($this->controlador.'::editAction', $this->params);
}
public function updateAction($rol, $id, $routeClassName)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
// $this->params['id'] = $id;
// $this->params['accion'] = $accion;
return $this->forward($this->controlador.'::updateAction', $this->params);
}
public function deleteAction($rol, $id, $routeClassName)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
// $this->params['rol'] = $rol;
// $this->params['id'] = $id;
return $this->forward($this->controlador.'::deleteAction', $this->params);
}
public function paginatorAction($rol, $routeClassName, $page)
{
$this->setInitialValues($rol, $routeClassName);
// $this->params['routeClassName'] = $routeClassName;
// $this->params['page'] = $page;
return $this->forward($this->controlador.'::paginator', $this->params);
}
}