| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Cdf\BiCoreBundle\Controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Cdf\BiCoreBundle\Utils\Arrays\ArrayUtils; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Cdf\BiCoreBundle\Utils\Entity\EntityUtils; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Cdf\BiCoreBundle\Utils\Entity\Finder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Cdf\BiCoreBundle\Utils\Tabella\ParametriTabella; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Symfony\Component\Asset\Packages; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Symfony\Component\HttpFoundation\JsonResponse; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Symfony\Component\HttpFoundation\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Symfony\Component\Security\Core\Exception\AccessDeniedException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * @codeCoverageIgnore | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @codeCoverageIgnore | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 18 |  |  |  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  | trait FiApiCoreControllerTrait | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |      * Lists all tables entities. | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |     public function index(Request $request, Packages $assetsmanager) | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |         $bundle = $this->getBundle(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |         $controller = $this->getController(); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |         $idpassato = $request->get('id'); | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |         if (!$this->getPermessi()->canRead($this->getController())) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |             throw new AccessDeniedException('Non si hanno i permessi per visualizzare questo contenuto'); | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |         $crudtemplate = $this->getCrudTemplate($bundle, $controller, $this->getThisFunctionName()); | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |         //$entityclassnotation = $this->getEntityClassNotation(); | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |         //$entityclass = $this->getEntityClassName(); | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |         $entityclassnotation = 'App:' . $this->model; | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |         // Variable containing API controller | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |         $modellocolonne = [ | 
            
                                                                        
                            
            
                                    
            
            
                | 44 |  |  |                 /* | 
            
                                                                        
                            
            
                                    
            
            
                | 45 |  |  |                   $controller . ".nominativo" => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 46 |  |  |                   "nometabella" => $controller, | 
            
                                                                        
                            
            
                                    
            
            
                | 47 |  |  |                   "nomecampo" => "nominativo", | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |                   "etichetta" => "Nominativo", | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |                   "ordine" => 10, | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |                   "larghezza" => 200, | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |                   "escluso" => false | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |                   ), | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |                   $controller . ".datanascita" => array( | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |                   "nometabella" => $controller, | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |                   "nomecampo" => "datanascita", | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |                   "etichetta" => "Data di nascita", | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |                   "ordine" => 20, | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |                   "larghezza" => 100, | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |                   "escluso" => false | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |                   ), | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |                  */ | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |         //append automatic computed enum options | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |         $modellocolonne = array_merge($modellocolonne, $this->enumOptions); | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |         //dump($modellocolonne); | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |         //dump($this->enumOptions); | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |         $filtri = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |         $prefiltri = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |         //$entityutils = new EntityUtils($this->get('doctrine')->getManager()); | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |         //$tablenamefromentity = $entityutils->getTableFromEntity($entityclass); | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |         $tablenamefromentity = $controller; | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |         $colonneordinamento = [$tablenamefromentity . '.id' => 'DESC']; | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |         $parametritabella = ['em' => ParametriTabella::setParameter('default'), | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  |             'tablename' => ParametriTabella::setParameter($tablenamefromentity), | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  |             'nomecontroller' => ParametriTabella::setParameter($controller), | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |             'bundle' => ParametriTabella::setParameter($bundle), | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |             'entityname' => ParametriTabella::setParameter($entityclassnotation), | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |             'entityclass' => ParametriTabella::setParameter($this->controllerItem), | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |             'formclass' => ParametriTabella::setParameter($this->formClass), | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |             'modellocolonne' => ParametriTabella::setParameter(json_encode($modellocolonne)), | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |             'permessi' => ParametriTabella::setParameter(json_encode($this->getPermessi()->toJson($controller))), | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |             'urltabella' => ParametriTabella::setParameter($assetsmanager->getUrl('') . $controller . '/' . 'tabella'), | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |             'baseurl' => ParametriTabella::setParameter($assetsmanager->getUrl('')), | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |             'idpassato' => ParametriTabella::setParameter($idpassato), | 
            
                                                                        
                            
            
                                    
            
            
                | 89 |  |  |             'titolotabella' => ParametriTabella::setParameter('Elenco ' . $controller), | 
            
                                                                        
                            
            
                                    
            
            
                | 90 |  |  |             'multiselezione' => ParametriTabella::setParameter('0'), | 
            
                                                                        
                            
            
                                    
            
            
                | 91 |  |  |             'editinline' => ParametriTabella::setParameter('0'), | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  |             'paginacorrente' => ParametriTabella::setParameter('1'), | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  |             'paginetotali' => ParametriTabella::setParameter(''), | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  |             'righetotali' => ParametriTabella::setParameter('0'), | 
            
                                                                        
                            
            
                                    
            
            
                | 95 |  |  |             'righeperpagina' => ParametriTabella::setParameter('15'), | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  |             'estraituttirecords' => ParametriTabella::setParameter('0'), | 
            
                                                                        
                            
            
                                    
            
            
                | 97 |  |  |             'colonneordinamento' => ParametriTabella::setParameter(json_encode($colonneordinamento)), | 
            
                                                                        
                            
            
                                    
            
            
                | 98 |  |  |             'filtri' => ParametriTabella::setParameter(json_encode($filtri)), | 
            
                                                                        
                            
            
                                    
            
            
                | 99 |  |  |             'prefiltri' => ParametriTabella::setParameter(json_encode($prefiltri)), | 
            
                                                                        
                            
            
                                    
            
            
                | 100 |  |  |             'traduzionefiltri' => ParametriTabella::setParameter(''), | 
            
                                                                        
                            
            
                                    
            
            
                | 101 |  |  |             'isApi' => ParametriTabella::setParameter('1'), | 
            
                                                                        
                            
            
                                    
            
            
                | 102 |  |  |             'apicontroller' => ParametriTabella::setParameter($this->apiController), | 
            
                                                                        
                            
            
                                    
            
            
                | 103 |  |  |             'apicollection' => ParametriTabella::setParameter($this->collection), | 
            
                                                                        
                            
            
                                    
            
            
                | 104 |  |  |             'oauth2_enabled' => ParametriTabella::setParameter($this->params->get("bi_core.oauth2_enabled")), | 
            
                                                                        
                            
            
                                    
            
            
                | 105 |  |  |             'oauth2_clientkey' => ParametriTabella::setParameter($this->params->get("bi_core.oauth2_clientkey")), | 
            
                                                                        
                            
            
                                    
            
            
                | 106 |  |  |             'oauth2_endpoint' => ParametriTabella::setParameter($this->params->get("bi_core.oauth2_endpoint")), | 
            
                                                                        
                            
            
                                    
            
            
                | 107 |  |  |             'api_project' => ParametriTabella::setParameter($this->getProject()), | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 108 |  |  |             'api_project_collection' => ParametriTabella::setParameter(strtolower($this->collection)) | 
            
                                                                        
                            
            
                                    
            
            
                | 109 |  |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |         return $this->render($crudtemplate, ['parametritabella' => $parametritabella]); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 112 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 114 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 115 |  |  |      * Lists all tables entities. | 
            
                                                                        
                            
            
                                    
            
            
                | 116 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 117 |  |  |   /*  public function indexDettaglio(Request $request, Packages $assetsmanager) | 
            
                                                                        
                            
            
                                    
            
            
                | 118 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 119 |  |  |         if (!$this->getPermessi()->canRead($this->getController())) { | 
            
                                                                        
                            
            
                                    
            
            
                | 120 |  |  |             throw new AccessDeniedException('Non si hanno i permessi per visualizzare questo contenuto'); | 
            
                                                                        
                            
            
                                    
            
            
                | 121 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 123 |  |  |         $bundle = $this->getBundle(); | 
            
                                                                        
                            
            
                                    
            
            
                | 124 |  |  |         $controller = $this->getController(); | 
            
                                                                        
                            
            
                                    
            
            
                | 125 |  |  |         $parametripassati = json_decode($request->get('parametripassati'), true); | 
            
                                                                        
                            
            
                                    
            
            
                | 126 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 127 |  |  |         $filtri = $this->getParametroIndexDettaglio($parametripassati, 'filtri', []); | 
            
                                                                        
                            
            
                                    
            
            
                | 128 |  |  |         $prefiltri = $this->getParametroIndexDettaglio($parametripassati, 'prefiltri', []); | 
            
                                                                        
                            
            
                                    
            
            
                | 129 |  |  |         $titolotabella = $this->getParametroIndexDettaglio($parametripassati, 'titolotabella', 'Elenco '.$controller); | 
            
                                                                        
                            
            
                                    
            
            
                | 130 |  |  |         $modellocolonne = $this->getParametroIndexDettaglio($parametripassati, 'modellocolonne', []); | 
            
                                                                        
                            
            
                                    
            
            
                | 131 |  |  |         $colonneordinamento = $this->getParametroIndexDettaglio($parametripassati, 'colonneordinamento', []); | 
            
                                                                        
                            
            
                                    
            
            
                | 132 |  |  |         $multiselezione = $this->getParametroIndexDettaglio($parametripassati, 'multiselezione', 0); | 
            
                                                                        
                            
            
                                    
            
            
                | 133 |  |  |         $parametriform = $this->getParametroIndexDettaglio($parametripassati, 'parametriform', []); | 
            
                                                                        
                            
            
                                    
            
            
                | 134 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 135 |  |  |         $template = $bundle.':'.$controller.':'.$this->getThisFunctionName().'.html.twig'; | 
            
                                                                        
                            
            
                                    
            
            
                | 136 |  |  |         if (!$this->get('twig')->getLoader()->exists($template)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 137 |  |  |             $template = $controller.'/Crud/'.$this->getThisFunctionName().'.html.twig'; | 
            
                                                                        
                            
            
                                    
            
            
                | 138 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 139 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 140 |  |  |         $entityclassnotation = $this->getEntityClassNotation(); | 
            
                                                                        
                            
            
                                    
            
            
                | 141 |  |  |         $entityclass = $this->getEntityClassName(); | 
            
                                                                        
                            
            
                                    
            
            
                | 142 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 143 |  |  |         $formclass = str_replace('Entity', 'Form', $entityclass); | 
            
                                                                        
                            
            
                                    
            
            
                | 144 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 145 |  |  |         $entityutils = new EntityUtils($this->get('doctrine')->getManager()); | 
            
                                                                        
                            
            
                                    
            
            
                | 146 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 147 |  |  |         $tablenamefromentity = $entityutils->getTableFromEntity($entityclass); | 
            
                                                                        
                            
            
                                    
            
            
                | 148 |  |  |         $parametritabella = ['em' => ParametriTabella::setParameter('default'), | 
            
                                                                        
                            
            
                                    
            
            
                | 149 |  |  |             'tablename' => ParametriTabella::setParameter($tablenamefromentity), | 
            
                                                                        
                            
            
                                    
            
            
                | 150 |  |  |             'nomecontroller' => ParametriTabella::setParameter($controller), | 
            
                                                                        
                            
            
                                    
            
            
                | 151 |  |  |             'bundle' => ParametriTabella::setParameter($bundle), | 
            
                                                                        
                            
            
                                    
            
            
                | 152 |  |  |             'entityname' => ParametriTabella::setParameter($entityclassnotation), | 
            
                                                                        
                            
            
                                    
            
            
                | 153 |  |  |             'entityclass' => ParametriTabella::setParameter($entityclass), | 
            
                                                                        
                            
            
                                    
            
            
                | 154 |  |  |             'formclass' => ParametriTabella::setParameter($formclass), | 
            
                                                                        
                            
            
                                    
            
            
                | 155 |  |  |             'parametriform' => ParametriTabella::setParameter(json_encode($parametriform)), | 
            
                                                                        
                            
            
                                    
            
            
                | 156 |  |  |             'modellocolonne' => ParametriTabella::setParameter(json_encode($modellocolonne)), | 
            
                                                                        
                            
            
                                    
            
            
                | 157 |  |  |             'permessi' => ParametriTabella::setParameter(json_encode($this->getPermessi()->toJson($controller))), | 
            
                                                                        
                            
            
                                    
            
            
                | 158 |  |  |             'urltabella' => ParametriTabella::setParameter($assetsmanager->getUrl('').$controller.'/'.'tabella'), | 
            
                                                                        
                            
            
                                    
            
            
                | 159 |  |  |             'baseurl' => ParametriTabella::setParameter($assetsmanager->getUrl('')), | 
            
                                                                        
                            
            
                                    
            
            
                | 160 |  |  |             'idpassato' => ParametriTabella::setParameter(0), | 
            
                                                                        
                            
            
                                    
            
            
                | 161 |  |  |             'titolotabella' => ParametriTabella::setParameter($titolotabella), | 
            
                                                                        
                            
            
                                    
            
            
                | 162 |  |  |             'multiselezione' => ParametriTabella::setParameter($multiselezione), | 
            
                                                                        
                            
            
                                    
            
            
                | 163 |  |  |             'editinline' => ParametriTabella::setParameter('1'), | 
            
                                                                        
                            
            
                                    
            
            
                | 164 |  |  |             'paginacorrente' => ParametriTabella::setParameter('1'), | 
            
                                                                        
                            
            
                                    
            
            
                | 165 |  |  |             'paginetotali' => ParametriTabella::setParameter(''), | 
            
                                                                        
                            
            
                                    
            
            
                | 166 |  |  |             'righeperpagina' => ParametriTabella::setParameter('15'), | 
            
                                                                        
                            
            
                                    
            
            
                | 167 |  |  |             'colonneordinamento' => ParametriTabella::setParameter(json_encode($colonneordinamento)), | 
            
                                                                        
                            
            
                                    
            
            
                | 168 |  |  |             'filtri' => ParametriTabella::setParameter(json_encode($filtri)), | 
            
                                                                        
                            
            
                                    
            
            
                | 169 |  |  |             'prefiltri' => ParametriTabella::setParameter(json_encode($prefiltri)), | 
            
                                                                        
                            
            
                                    
            
            
                | 170 |  |  |             'traduzionefiltri' => ParametriTabella::setParameter(''), | 
            
                                                                        
                            
            
                                    
            
            
                | 171 |  |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 173 |  |  |         return $this->render( | 
            
                                                                        
                            
            
                                    
            
            
                | 174 |  |  |             $template, | 
            
                                                                        
                            
            
                                    
            
            
                | 175 |  |  |             [ | 
            
                                                                        
                            
            
                                    
            
            
                | 176 |  |  |                             'parametritabella' => $parametritabella, | 
            
                                                                        
                            
            
                                    
            
            
                | 177 |  |  |                         ] | 
            
                                                                        
                            
            
                                    
            
            
                | 178 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 179 |  |  |     }*/ | 
            
                                                                        
                            
            
                                    
            
            
                | 180 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 181 |  |  |   /*  protected function getParametroIndexDettaglio($parametripassati, $keyparametro, $defaultvalue) | 
            
                                                                        
                            
            
                                    
            
            
                | 182 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 183 |  |  |         if (isset($parametripassati[$keyparametro])) { | 
            
                                                                        
                            
            
                                    
            
            
                | 184 |  |  |             $parametro = $parametripassati[$keyparametro]; | 
            
                                                                        
                            
            
                                    
            
            
                | 185 |  |  |         } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 186 |  |  |             $parametro = $defaultvalue; | 
            
                                                                        
                            
            
                                    
            
            
                | 187 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 188 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 189 |  |  |         return $parametro; | 
            
                                                                        
                            
            
                                    
            
            
                | 190 |  |  |     }*/ | 
            
                                                                        
                            
            
                                    
            
            
                | 191 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 192 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 193 |  |  |      * Lists all tables entities. | 
            
                                                                        
                            
            
                                    
            
            
                | 194 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 195 |  |  |   /*  public function lista(Request $request) | 
            
                                                                        
                            
            
                                    
            
            
                | 196 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 197 |  |  |         if (!$this->getPermessi()->canRead($this->getController())) { | 
            
                                                                        
                            
            
                                    
            
            
                | 198 |  |  |             throw new AccessDeniedException('Non si hanno i permessi per visualizzare questo contenuto'); | 
            
                                                                        
                            
            
                                    
            
            
                | 199 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 200 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 201 |  |  |         $entityclassnotation = $this->getEntityClassNotation(); | 
            
                                                                        
                            
            
                                    
            
            
                | 202 |  |  |         $em = $this->get('doctrine')->getManager(); | 
            
                                                                        
                            
            
                                    
            
            
                | 203 |  |  |         $righe = $em->getRepository($entityclassnotation)->findAll(); | 
            
                                                                        
                            
            
                                    
            
            
                | 204 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 205 |  |  |         $lista = []; | 
            
                                                                        
                            
            
                                    
            
            
                | 206 |  |  |         foreach ($righe as $riga) { | 
            
                                                                        
                            
            
                                    
            
            
                | 207 |  |  |             $lista[] = ['id' => $riga->getId(), 'descrizione' => $riga->__toString()]; | 
            
                                                                        
                            
            
                                    
            
            
                | 208 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 209 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 210 |  |  |         return new JsonResponse(ArrayUtils::arrayOrderby($lista, 'descrizione', SORT_ASC)); | 
            
                                                                        
                            
            
                                    
            
            
                | 211 |  |  |     }*/ | 
            
                                                                        
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 213 |  |  |     protected function getTabellaTemplate($controller) | 
            
                                                                        
                            
            
                                    
            
            
                | 214 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 215 |  |  |         $tabellatemplate = $controller . '/Tabella/tabellaform.html.twig'; | 
            
                                                                        
                            
            
                                    
            
            
                | 216 |  |  |         if (!$this->get('twig')->getLoader()->exists($tabellatemplate)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 217 |  |  |             $tabellatemplate = '@BiCore/' . $controller . '/Tabella/tabellaform.html.twig'; | 
            
                                                                        
                            
            
                                    
            
            
                | 218 |  |  |             if (!$this->get('twig')->getLoader()->exists($tabellatemplate)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 219 |  |  |                 $tabellatemplate = '@BiCore/Standard/Tabella/tabellaform.html.twig'; | 
            
                                                                        
                            
            
                                    
            
            
                | 220 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 221 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 222 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 223 |  |  |         return $tabellatemplate; | 
            
                                                                        
                            
            
                                    
            
            
                | 224 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 225 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 226 |  |  |     protected function getCrudTemplate($bundle, $controller, $operation) | 
            
                                                                        
                            
            
                                    
            
            
                | 227 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 228 |  |  |         $crudtemplate = $bundle . '/' . $controller . '/Crud/' . $operation . '.html.twig'; | 
            
                                                                        
                            
            
                                    
            
            
                | 229 |  |  |         if (!$this->get('twig')->getLoader()->exists($crudtemplate)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 230 |  |  |             $crudtemplate = $controller . '/Crud/' . $operation . '.html.twig'; | 
            
                                                                        
                            
            
                                    
            
            
                | 231 |  |  |             if (!$this->get('twig')->getLoader()->exists($crudtemplate)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 232 |  |  |                 $crudtemplate = '@BiCore/Standard/Crud/' . $operation . '.html.twig'; | 
            
                                                                        
                            
            
                                    
            
            
                | 233 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 234 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 235 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 236 |  |  |         return $crudtemplate; | 
            
                                                                        
                            
            
                                    
            
            
                | 237 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 238 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 239 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 240 |  |  |      * Returns the calling function through a backtrace. | 
            
                                                                        
                            
            
                                    
            
            
                | 241 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 242 |  |  |     protected function getThisFunctionName() | 
            
                                                                        
                            
            
                                    
            
            
                | 243 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 244 |  |  |         // a funciton x has called a function y which called this | 
            
                                                                        
                            
            
                                    
            
            
                | 245 |  |  |         // see stackoverflow.com/questions/190421 | 
            
                                                                        
                            
            
                                    
            
            
                | 246 |  |  |         $caller = debug_backtrace(); | 
            
                                                                        
                            
            
                                    
            
            
                | 247 |  |  |         $caller = $caller[1]; | 
            
                                                                        
                            
            
                                    
            
            
                | 248 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 249 |  |  |         return $caller['function']; | 
            
                                                                        
                            
            
                                    
            
            
                | 250 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 251 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 252 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 253 |  |  |      * Return the model class name needed to instantiate it | 
            
                                                                        
                            
            
                                    
            
            
                | 254 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 255 |  |  |     protected function getModelClassName(): string | 
            
                                                                        
                            
            
                                    
            
            
                | 256 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 257 |  |  |         return $this->modelClass; | 
            
                                                                        
                            
            
                                    
            
            
                | 258 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 259 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 260 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 261 |  |  |      * Return the controller item class name needed to instantiate it | 
            
                                                                        
                            
            
                                    
            
            
                | 262 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |     protected function getControllerItemName(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 265 |  |  |         return $this->controllerItem; | 
            
                                                                        
                            
            
                                    
            
            
                | 266 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 267 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 268 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 269 |  |  |      * Return the form class name needed to reference the proper form | 
            
                                                                        
                            
            
                                    
            
            
                | 270 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |     protected function getFormName(): string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |     { | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 273 |  |  |         return $this->formClass; | 
            
                                                                        
                                                                
            
                                    
            
            
                | 274 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 275 |  |  |  | 
            
                                                                        
                                                                
            
                                    
            
            
                | 276 |  |  |        /* protected function getEntityClassNotation() | 
            
                                                                        
                                                                
            
                                    
            
            
                | 277 |  |  |     { | 
            
                                                                        
                                                                
            
                                    
            
            
                | 278 |  |  |         $em = $this->get('doctrine')->getManager(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |         $entityutils = new EntityUtils($em); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |         return $entityutils->getClassNameToShortcutNotations($this->getEntityClassName()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |     }*/ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |    /* protected function getEntityClassName() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |         $em = $this->get('doctrine')->getManager(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |         $entityfinder = new Finder($em); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |         return $entityfinder->getClassNameFromEntityName($this->controller); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |     }*/ | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 291 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 292 |  |  |  |