|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Cdf\BiCoreBundle\Controller; |
|
4
|
|
|
|
|
5
|
|
|
use Cdf\BiCoreBundle\Service\Permessi\PermessiManager; |
|
6
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; |
|
7
|
|
|
use Twig\Environment; |
|
8
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
9
|
|
|
use function count; |
|
10
|
|
|
use ReflectionClass; |
|
11
|
|
|
|
|
12
|
|
|
class FiController extends AbstractController |
|
13
|
|
|
{ |
|
14
|
|
|
use FiCoreControllerTrait; |
|
15
|
|
|
use FiCoreCrudControllerTrait; |
|
|
|
|
|
|
16
|
|
|
use FiCoreTabellaControllerTrait; |
|
17
|
|
|
|
|
18
|
|
|
protected string $bundle; |
|
19
|
|
|
protected Environment $template; |
|
20
|
|
|
protected string $controller; |
|
21
|
|
|
protected PermessiManager $permessi; |
|
22
|
|
|
protected EntityManagerInterface $em; |
|
23
|
|
|
|
|
24
|
17 |
|
public function __construct(PermessiManager $permessi, Environment $template, EntityManagerInterface $em) |
|
25
|
|
|
{ |
|
26
|
17 |
|
$matches = []; |
|
27
|
17 |
|
$controllo = new ReflectionClass(get_class($this)); |
|
28
|
|
|
|
|
29
|
17 |
|
preg_match('/(.*)\\\(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches); |
|
30
|
17 |
|
if (0 == count($matches)) { |
|
31
|
10 |
|
preg_match('/(.*)(.*)\\\Controller\\\(.*)Controller/', $controllo->name, $matches); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
17 |
|
$this->bundle = ($matches[count($matches) - 2] ? $matches[count($matches) - 2] : $matches[count($matches) - 3]); |
|
35
|
17 |
|
$this->controller = $matches[count($matches) - 1]; |
|
36
|
17 |
|
$this->permessi = $permessi; |
|
37
|
17 |
|
$this->template = $template; |
|
38
|
17 |
|
$this->em = $em; |
|
39
|
17 |
|
} |
|
40
|
|
|
|
|
41
|
15 |
|
protected function getBundle() |
|
42
|
|
|
{ |
|
43
|
15 |
|
return $this->bundle; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
17 |
|
protected function getController() |
|
47
|
|
|
{ |
|
48
|
17 |
|
return $this->controller; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
16 |
|
protected function getPermessi() |
|
52
|
|
|
{ |
|
53
|
16 |
|
return $this->permessi; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
protected function getTemplate() |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->template; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|