1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Dominikzogg\EnergyCalculator\Controller; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Persistence\ManagerRegistry; |
6
|
|
|
use Knp\Component\Pager\PaginatorInterface; |
7
|
|
|
use Saxulum\Crud\Controller\CrudTrait; |
8
|
|
|
use Saxulum\Crud\Listing\ListingFactory; |
9
|
|
|
use Symfony\Component\Form\FormFactory; |
10
|
|
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
11
|
|
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; |
12
|
|
|
|
13
|
|
|
abstract class AbstractCRUDController extends AbstractController |
14
|
|
|
{ |
15
|
|
|
use CrudTrait; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var PaginatorInterface |
19
|
|
|
*/ |
20
|
|
|
protected $paginator; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var UrlGeneratorInterface |
24
|
|
|
*/ |
25
|
|
|
protected $urlGenerator; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var ListingFactory |
29
|
|
|
*/ |
30
|
|
|
protected $listingFactory; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @return AuthorizationCheckerInterface |
34
|
|
|
*/ |
35
|
|
|
protected function crudAuthorizationChecker() |
36
|
|
|
{ |
37
|
|
|
return $this->authorizationChecker; |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @return FormFactory |
42
|
|
|
*/ |
43
|
|
|
protected function crudFormFactory() |
44
|
|
|
{ |
45
|
|
|
return $this->formFactory; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return ManagerRegistry |
50
|
|
|
*/ |
51
|
|
|
protected function crudDoctrine() |
52
|
|
|
{ |
53
|
|
|
return $this->doctrine; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return PaginatorInterface |
58
|
|
|
*/ |
59
|
|
|
protected function crudPaginator() |
60
|
|
|
{ |
61
|
|
|
return $this->paginator; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return \Twig_Environment |
66
|
|
|
*/ |
67
|
|
|
protected function crudTwig() |
68
|
|
|
{ |
69
|
|
|
return $this->twig; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return UrlGeneratorInterface |
74
|
|
|
*/ |
75
|
|
|
protected function crudUrlGenerator() |
76
|
|
|
{ |
77
|
|
|
return $this->urlGenerator; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return ListingFactory |
82
|
|
|
*/ |
83
|
|
|
protected function crudListingFactory() |
84
|
|
|
{ |
85
|
|
|
return $this->listingFactory; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
|
|
protected function crudTemplatePattern() |
92
|
|
|
{ |
93
|
|
|
return '@DominikzoggEnergyCalculator/%s/%s.html.twig'; |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|