Skip to content

Commit e8bcce7

Browse files
committed
merged branch GromNaN/fix_crud_read_only (PR sensiolabs#52)
Commits ------- 9bff739 Remove the delete form from the show action when the controller is generated without the write actions Discussion ---------- Remove the delete form from the show action. Remove the delete form from the show action when the controller is generated without the write actions.
2 parents 7a31def + 9bff739 commit e8bcce7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Resources/skeleton/crud/actions/show.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@ public function showAction($id)
1616
if (!$entity) {
1717
throw $this->createNotFoundException('Unable to find {{ entity }} entity.');
1818
}
19+
{% if 'delete' in actions %}
1920

2021
$deleteForm = $this->createDeleteForm($id);
22+
{% endif %}
2123

2224
{% if 'annotation' == format %}
2325
return array(
2426
'entity' => $entity,
27+
{% if 'delete' in actions %}
2528
'delete_form' => $deleteForm->createView(),
29+
{%- endif %}
2630
);
2731
{% else %}
2832
return $this->render('{{ bundle }}:{{ entity|replace({'\\': '/'}) }}:show.html.twig', array(
2933
'entity' => $entity,
34+
{% if 'delete' in actions %}
3035
'delete_form' => $deleteForm->createView(),
36+
{% endif %}
3137
));
3238
{% endif %}
3339
}

0 commit comments

Comments
 (0)