Skip to content

Commit 31d9e81

Browse files
committed
fix templates generation with date fields in entity
1 parent 1b0f17a commit 31d9e81

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/Resources/skeleton/crud/controller/ControllerWithTwig.tpl.php

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class <?= $controller_class_name; ?> extends Controller
1717
{
1818
/**
1919
* @Route("/", name="index")
20+
*
21+
* @return Response
2022
*/
2123
public function index()
2224
{

src/Resources/skeleton/crud/templates/index.tpl.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<tbody>
1414
{% for <?= $entity_var_singular; ?> in <?= $entity_var_plural; ?> %}
1515
<tr>
16-
<?php foreach ($entity_fields as $field): ?><td>{{ <?= $entity_var_singular; ?>.<?= $field['fieldName']; ?> }}</td>
16+
<?php foreach ($entity_fields as $field): ?><td>{{ <?= $entity_var_singular; ?>.<?= $field['fieldName'].(false === strpos($field['type'], 'date') ?'':'|date(\'Y-m-d\TH:i:sP\')'); ?> }}</td>
1717
<?php endforeach; ?>
1818
<td>
1919
<a href="{{ path('<?= $route_name; ?>_show', {'<?= $entity_identifier; ?>':<?= $entity_var_singular; ?>.<?= $entity_identifier; ?>}) }}">show</a>

src/Resources/skeleton/crud/templates/show.tpl.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<?php foreach ($entity_fields as $field): ?>
88
<tr>
99
<th><?= ucfirst($field['fieldName']); ?></th>
10-
<td>{{ <?= $entity_var_singular; ?>.<?= $field['fieldName']; ?> }}</td>
10+
<td>{{ <?= $entity_var_singular; ?>.<?= $field['fieldName'].(false === strpos($field['type'], 'date') ?'':'|date(\'Y-m-d\TH:i:sP\')'); ?> }}</td>
1111
</tr>
1212
<?php endforeach; ?>
1313
</table>

0 commit comments

Comments
 (0)