mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
wip delete comment
This commit is contained in:
@@ -16,6 +16,7 @@ use Chill\PersonBundle\Form\AccompanyingCourseCommentType;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -27,7 +28,7 @@ use function array_key_exists;
|
||||
class AccompanyingCourseCommentController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Comments page of Accompanying Course section.
|
||||
* Page of comments in Accompanying Course section.
|
||||
*
|
||||
* @Route("/{_locale}/parcours/{accompanying_period_id}/comments", name="chill_person_accompanying_period_comment_list")
|
||||
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
|
||||
@@ -101,4 +102,39 @@ class AccompanyingCourseCommentController extends AbstractController
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
////////////// building
|
||||
/**
|
||||
* Delete an existing comment
|
||||
*
|
||||
* @Route(
|
||||
* "/{_locale}/parcours/{accompanying_period_id}/comment/{comment_id}/delete",
|
||||
* name="chill_person_accompanying_period_comment_delete"
|
||||
* )
|
||||
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
|
||||
* @ParamConverter("comment", options={"id": "comment_id"})
|
||||
*/
|
||||
public function deleteAction(AccompanyingPeriod $accompanyingCourse, AccompanyingPeriod\Comment $comment, Request $request)
|
||||
{
|
||||
$form = $this->createDeleteForm($comment->getId(), $accompanyingCourse);
|
||||
|
||||
return $this->render('@ChillPerson/AccompanyingCourse/confirm_delete_comment.html.twig', [
|
||||
'comment' => $comment,
|
||||
'delete_form' => $form->createView(),
|
||||
'accompanyingCourse' => $accompanyingCourse,
|
||||
]);
|
||||
}
|
||||
|
||||
private function createDeleteForm(int $id, ?AccompanyingPeriod $accompanyingCourse): FormInterface
|
||||
{
|
||||
$form = $this->createForm($type);
|
||||
|
||||
return $this->createFormBuilder()
|
||||
->setAction($this->generateUrl('chill_person_accompanying_period_comment_delete', $params))
|
||||
->setMethod('DELETE')
|
||||
->add('submit', SubmitType::class, ['label' => 'Delete'])
|
||||
->getForm();
|
||||
}
|
||||
|
||||
//// end
|
||||
}
|
||||
|
Reference in New Issue
Block a user