1 | <?php |
||
23 | trait FormAwareMethods |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var EntityUpdateService |
||
28 | */ |
||
29 | protected $updateService; |
||
30 | |||
31 | /** |
||
32 | * @return FormInterface|EntityForm |
||
33 | */ |
||
34 | abstract function getForm(); |
||
35 | |||
36 | /** |
||
37 | * Get invalid form data message |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | protected function getInvalidFormDataMessage() |
||
48 | |||
49 | /** |
||
50 | * Get invalid form data message |
||
51 | * |
||
52 | * @param \Exception $caught |
||
53 | * |
||
54 | * @return string |
||
55 | */ |
||
56 | protected function getGeneralErrorMessage(\Exception $caught) |
||
62 | |||
63 | /** |
||
64 | * Get entity singular name used on controller actions |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | abstract protected function getEntityNameSingular(); |
||
69 | |||
70 | /** |
||
71 | * Get update service |
||
72 | * |
||
73 | * @return EntityUpdateService |
||
74 | */ |
||
75 | public function getUpdateService() |
||
84 | |||
85 | /** |
||
86 | * Set update service |
||
87 | * |
||
88 | * @param EntityUpdateService $updateService |
||
89 | * |
||
90 | * @return EntityCreateMethods |
||
91 | */ |
||
92 | public function setUpdateService(EntityUpdateService $updateService) |
||
97 | |||
98 | /** |
||
99 | * Get a new entity |
||
100 | * |
||
101 | * @return Entity |
||
102 | */ |
||
103 | protected function getNewEntity() |
||
108 | |||
109 | /** |
||
110 | * Gets the entity FQ class name |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | abstract public function getEntityClassName(); |
||
115 | |||
116 | /** |
||
117 | * Returns the translation for the provided message |
||
118 | * |
||
119 | * @param string $message |
||
120 | * @param string $domain |
||
121 | * @param string $locale |
||
122 | * |
||
123 | * @return string |
||
124 | */ |
||
125 | abstract public function translate( |
||
128 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.