| Total Complexity | 1 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class DateTimeChildBuilder extends ChildBuilder |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * The model value of the input will be transformer to a timestamp |
||
| 17 | * |
||
| 18 | * <code> |
||
| 19 | * // The entity : date is a timestamp |
||
| 20 | * class MyEntity { |
||
| 21 | * public int $date; |
||
| 22 | * } |
||
| 23 | * |
||
| 24 | * // Build the element |
||
| 25 | * $builder->dateTime('date')->saveAsTimestamp()->getter()->setter(); |
||
| 26 | * |
||
| 27 | * $form->import(MyEntity::get($id)); |
||
| 28 | * $form['date']->element()->value(); // Value is an instance of DateTime |
||
| 29 | * |
||
| 30 | * $entity = $form->value(); |
||
| 31 | * $entity->date; // date is a timestamp (i.e. integer value) |
||
| 32 | * </code> |
||
| 33 | * |
||
| 34 | * @return $this |
||
| 35 | * |
||
| 36 | * @see DateTimeToTimestampTransformer |
||
| 37 | */ |
||
| 38 | 1 | public function saveAsTimestamp(): self |
|
| 43 |