|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace LAG\AdminBundle\Action; |
|
4
|
|
|
|
|
5
|
|
|
use LAG\AdminBundle\Action\Configuration\ActionConfiguration; |
|
6
|
|
|
use LAG\AdminBundle\Admin\Admin; |
|
7
|
|
|
use LAG\AdminBundle\Admin\Behaviors\AdminAwareTrait; |
|
8
|
|
|
use LAG\AdminBundle\Field\FieldInterface; |
|
9
|
|
|
use LAG\AdminBundle\Responder\ResponderInterface; |
|
10
|
|
|
use Symfony\Component\Form\FormFactoryInterface; |
|
11
|
|
|
|
|
12
|
|
|
abstract class Action implements ActionInterface |
|
13
|
|
|
{ |
|
14
|
|
|
use AdminAwareTrait; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Action name. |
|
18
|
|
|
* |
|
19
|
|
|
* @var string |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $name; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Action configuration (it has been resolved so it should be valid). |
|
25
|
|
|
* |
|
26
|
|
|
* @var ActionConfiguration |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $configuration; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Form factory. |
|
32
|
|
|
* |
|
33
|
|
|
* @var FormFactoryInterface |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $formFactory; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var FieldInterface[] |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $fields = []; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @inheritdoc |
|
44
|
|
|
* |
|
45
|
|
|
* @param ActionConfiguration $configuration |
|
46
|
|
|
*/ |
|
47
|
4 |
|
public function setConfiguration(ActionConfiguration $configuration) |
|
48
|
|
|
{ |
|
49
|
4 |
|
$this->configuration = $configuration; |
|
50
|
4 |
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @inheritdoc |
|
54
|
|
|
* |
|
55
|
|
|
* @return ActionConfiguration |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getConfiguration() |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->configuration; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @inheritdoc |
|
64
|
|
|
* |
|
65
|
|
|
* @return bool |
|
66
|
|
|
*/ |
|
67
|
|
|
public function isLoadingRequired() |
|
68
|
|
|
{ |
|
69
|
|
|
return Admin::LOAD_STRATEGY_NONE !== $this |
|
70
|
|
|
->configuration |
|
71
|
|
|
->getParameter('load_strategy') |
|
72
|
|
|
; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @inheritdoc |
|
77
|
|
|
* |
|
78
|
|
|
* @return string |
|
79
|
|
|
*/ |
|
80
|
|
|
public function getName() |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->name; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* @return FieldInterface[] |
|
87
|
|
|
*/ |
|
88
|
|
|
public function getFields() |
|
89
|
|
|
{ |
|
90
|
|
|
return $this->fields; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* @param FieldInterface[] $fields |
|
95
|
|
|
*/ |
|
96
|
|
|
public function setFields(array $fields) |
|
97
|
|
|
{ |
|
98
|
|
|
$this->fields = $fields; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
public function getResponder() |
|
102
|
|
|
{ |
|
103
|
|
|
// TODO: Implement getResponder() method. |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
public function setResponder(ResponderInterface $responder) |
|
107
|
|
|
{ |
|
108
|
|
|
// TODO: Implement setResponder() method. |
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|