Skip to content

Commit 6e1396e

Browse files
committed
Delete all post/tag entries on delete Post
1 parent df2960b commit 6e1396e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/AppBundle/Controller/Admin/BlogController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ public function deleteAction(Request $request, Post $post)
177177

178178
$entityManager = $this->getDoctrine()->getManager();
179179

180+
// Delete related symfony_demo_post_tag entries. This is necessary for SQLite platform only,
181+
// you can remove it for another platform.
182+
$post->getTags()->clear();
183+
180184
$entityManager->remove($post);
181185
$entityManager->flush();
182186

0 commit comments

Comments
 (0)