mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-30 22:16:14 +00:00
fix deprecations: pass Request in the Action function instead of using getRequest method
This commit is contained in:
parent
80bef1f558
commit
73f5295f40
@ -42,7 +42,7 @@ class AccompanyingPeriodController extends Controller
|
|||||||
'person' => $person));
|
'person' => $person));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createAction($person_id) {
|
public function createAction($person_id, Request $request) {
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
|
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
|
||||||
@ -57,8 +57,6 @@ class AccompanyingPeriodController extends Controller
|
|||||||
$form = $this->createForm(AccompanyingPeriodType::class,
|
$form = $this->createForm(AccompanyingPeriodType::class,
|
||||||
$accompanyingPeriod, array('period_action' => 'create'));
|
$accompanyingPeriod, array('period_action' => 'create'));
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
$errors = $this->_validatePerson($person);
|
$errors = $this->_validatePerson($person);
|
||||||
@ -95,7 +93,7 @@ class AccompanyingPeriodController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateAction($person_id, $period_id){
|
public function updateAction($person_id, $period_id, Request $request){
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$accompanyingPeriod = $em->getRepository('ChillPersonBundle:AccompanyingPeriod')
|
$accompanyingPeriod = $em->getRepository('ChillPersonBundle:AccompanyingPeriod')
|
||||||
@ -113,7 +111,6 @@ class AccompanyingPeriodController extends Controller
|
|||||||
|
|
||||||
$form = $this->createForm(AccompanyingPeriodType::class,
|
$form = $this->createForm(AccompanyingPeriodType::class,
|
||||||
$accompanyingPeriod, array('period_action' => 'update'));
|
$accompanyingPeriod, array('period_action' => 'update'));
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
@ -148,7 +145,7 @@ class AccompanyingPeriodController extends Controller
|
|||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function closeAction($person_id) {
|
public function closeAction($person_id, Request $request) {
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
|
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
|
||||||
@ -171,8 +168,6 @@ class AccompanyingPeriodController extends Controller
|
|||||||
'period_action' => 'close'
|
'period_action' => 'close'
|
||||||
));
|
));
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
if ($request->getMethod() === 'POST') {
|
if ($request->getMethod() === 'POST') {
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
@ -244,14 +239,12 @@ class AccompanyingPeriodController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function openAction($person_id) {
|
public function openAction($person_id, Request $request) {
|
||||||
$person = $this->_getPerson($person_id);
|
$person = $this->_getPerson($person_id);
|
||||||
|
|
||||||
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
|
$this->denyAccessUnlessGranted(PersonVoter::UPDATE, $person,
|
||||||
'You are not allowed to update this person');
|
'You are not allowed to update this person');
|
||||||
|
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
//in case the person is already open
|
//in case the person is already open
|
||||||
if ($person->isOpen()) {
|
if ($person->isOpen()) {
|
||||||
$this->get('session')->getFlashBag()
|
$this->get('session')->getFlashBag()
|
||||||
|
@ -216,10 +216,8 @@ class PersonController extends Controller
|
|||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reviewAction()
|
public function reviewAction(Request $request)
|
||||||
{
|
{
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
if ($request->getMethod() !== 'POST') {
|
if ($request->getMethod() !== 'POST') {
|
||||||
$r = new Response("You must send something to review the creation of a new Person");
|
$r = new Response("You must send something to review the creation of a new Person");
|
||||||
$r->setStatusCode(400);
|
$r->setStatusCode(400);
|
||||||
@ -317,9 +315,8 @@ class PersonController extends Controller
|
|||||||
'form' => $form->createView()));
|
'form' => $form->createView()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function createAction()
|
public function createAction(Request $request)
|
||||||
{
|
{
|
||||||
$request = $this->getRequest();
|
|
||||||
|
|
||||||
if ($request->getMethod() !== 'POST') {
|
if ($request->getMethod() !== 'POST') {
|
||||||
$r = new Response('You must send something to create a person !');
|
$r = new Response('You must send something to create a person !');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user