1 | <?php |
||
25 | abstract class AbstractColumn implements ColumnInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $name; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | |||
36 | protected $field; |
||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $options = []; |
||
41 | |||
42 | /** |
||
43 | * @var TranslatorInterface |
||
44 | */ |
||
45 | protected $translator; |
||
46 | |||
47 | /** |
||
48 | * AbstractColumn constructor. |
||
49 | * @param string $name |
||
50 | * @param string $field |
||
51 | * @param array $options |
||
52 | */ |
||
53 | public function __construct($name, $field, array $options = []) |
||
62 | |||
63 | /** |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getName() : ?string |
||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getField() : ?string |
||
78 | |||
79 | /** |
||
80 | * @param mixed $value |
||
81 | * @param mixed $object |
||
82 | * @param mixed $primary |
||
83 | * @param \Twig_Environment $twig |
||
84 | * |
||
85 | * @return mixed |
||
86 | */ |
||
87 | public function render($value, $object, $primary, \Twig_Environment $twig) |
||
104 | |||
105 | /** |
||
106 | * @param \Twig_Environment $twig |
||
107 | * @param string $template |
||
108 | * @param array $options |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | protected function renderTemplate(\Twig_Environment $twig, $template, $options) |
||
118 | |||
119 | /** |
||
120 | * set defaults options |
||
121 | * @param OptionsResolver $resolver |
||
122 | */ |
||
123 | public function configureOptions(OptionsResolver $resolver) |
||
169 | |||
170 | /** |
||
171 | * @return array |
||
172 | */ |
||
173 | public function buildColumnOptions() : array |
||
206 | |||
207 | /** |
||
208 | * @param mixed $object |
||
209 | * @param string $field |
||
210 | * @param string $primary |
||
211 | * @param PropertyAccessor $accessor |
||
212 | * |
||
213 | * @return mixed |
||
214 | */ |
||
215 | public function getValue($object, $field, $primary, $accessor) |
||
237 | |||
238 | /** |
||
239 | * @param string $name |
||
240 | * @return bool |
||
241 | */ |
||
242 | public function hasOption($name) : bool |
||
246 | |||
247 | /** |
||
248 | * @param string $name |
||
249 | * @param string|null $default |
||
250 | * @return misc |
||
251 | */ |
||
252 | public function getOption(string $name, $default = null) |
||
256 | |||
257 | /** |
||
258 | * @return array |
||
259 | */ |
||
260 | public function getOptions() : array |
||
264 | |||
265 | /** |
||
266 | * @return TranslatorInterface |
||
267 | */ |
||
268 | public function getTranslator() : TranslatorInterface |
||
272 | |||
273 | /** |
||
274 | * @param TranslatorInterface $translator |
||
275 | */ |
||
276 | public function setTranslator(TranslatorInterface $translator) |
||
280 | |||
281 | |||
282 | } |
||
283 |