mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
form type and controller, wip
This commit is contained in:
parent
be5f54c142
commit
8b2a8544b8
@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Controller;
|
|||||||
use Chill\ActivityBundle\Entity\Activity;
|
use Chill\ActivityBundle\Entity\Activity;
|
||||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
|
use Chill\PersonBundle\Form\AccompanyingCourseCommentType;
|
||||||
use Chill\PersonBundle\Form\AccompanyingCourseType;
|
use Chill\PersonBundle\Form\AccompanyingCourseType;
|
||||||
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository;
|
||||||
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
|
||||||
@ -217,18 +218,31 @@ class AccompanyingCourseController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comments page of Accompanying Course section.
|
* Comments page of Accompanying Course section.
|
||||||
*
|
*
|
||||||
* @Route("/{_locale}/parcours/{accompanying_period_id}/comment", name="chill_person_accompanying_period_comment_list")
|
* @Route("/{_locale}/parcours/{accompanying_period_id}/comments", name="chill_person_accompanying_period_comment_list")
|
||||||
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
|
* @ParamConverter("accompanyingCourse", options={"id": "accompanying_period_id"})
|
||||||
*/
|
*/
|
||||||
public function commentAction(AccompanyingPeriod $accompanyingCourse): Response
|
public function commentAction(AccompanyingPeriod $accompanyingCourse, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
|
$form = $this->createForm(AccompanyingCourseCommentType::class, $comment, []);
|
||||||
|
|
||||||
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$em->persist($comment);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
return $this->render('@ChillPerson/AccompanyingCourse/comment_list.html.twig', [
|
return $this->render('@ChillPerson/AccompanyingCourse/comment_list.html.twig', [
|
||||||
'accompanyingCourse' => $accompanyingCourse,
|
'accompanyingCourse' => $accompanyingCourse,
|
||||||
|
// 'form' => $form->createView()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Chill is a software for social workers
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view
|
||||||
|
* the LICENSE file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Chill\PersonBundle\Form;
|
||||||
|
|
||||||
|
use Chill\MainBundle\Form\Type\ChillTextareaType;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||||
|
use Symfony\Component\Form\AbstractType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
|
class AccompanyingCourseCommentType extends AbstractType
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param FormBuilderInterface $builder
|
||||||
|
* @param array $options
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
{
|
||||||
|
$builder->add('content', ChillTextareaType::class, []);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param OptionsResolver $resolver
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
{
|
||||||
|
$resolver->setDefault('class', Comment::class);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user