| 1 | <?php |
||
| 10 | class DateTimeColumn extends AbstractColumn |
||
| 11 | { |
||
| 12 | public function buildCell(Cell $cell, array $options) |
||
| 13 | { |
||
| 14 | $value = $cell->value; |
||
| 15 | |||
| 16 | if (null === $value) { |
||
| 17 | return; |
||
| 18 | } |
||
| 19 | |||
| 20 | if (false === $value instanceof \DateTime) { |
||
| 21 | throw new \InvalidArgumentException(sprintf( |
||
| 22 | 'The DateTime column requires a \DateTime value at "%s", but got "%s"', |
||
| 23 | $options['property'], is_object($value) ? get_class($value) : gettype($value) |
||
| 24 | )); |
||
| 25 | } |
||
| 26 | |||
| 27 | $cell->parameters['format'] = $options['format']; |
||
| 28 | } |
||
| 29 | |||
| 30 | public function configureOptions(OptionsResolver $resolver) |
||
| 34 | |||
| 35 | public function getParent() |
||
| 39 | } |
||
| 40 |