mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 03:23:48 +00:00
fix: SA: Fix "might not be defined" rule.
SA stands for Static Analysis.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\TaskBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\Entity\Scope;
|
||||
@@ -41,14 +43,8 @@ use Symfony\Component\HttpFoundation\RequestStack;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as TranslationTranslatorInterface;
|
||||
|
||||
/**
|
||||
* Class SingleTaskController
|
||||
*
|
||||
* @package Chill\TaskBundle\Controller
|
||||
*/
|
||||
final class SingleTaskController extends AbstractController
|
||||
{
|
||||
|
||||
private EventDispatcherInterface $eventDispatcher;
|
||||
private TimelineBuilder $timelineBuilder;
|
||||
private LoggerInterface $logger;
|
||||
@@ -332,15 +328,12 @@ final class SingleTaskController extends AbstractController
|
||||
* name="chill_task_single_task_delete"
|
||||
* )
|
||||
*/
|
||||
public function deleteAction(
|
||||
Request $request,
|
||||
$id
|
||||
) {
|
||||
|
||||
public function deleteAction(Request $request, $id) {
|
||||
$course = null;
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$task = $em->getRepository(SingleTask::class)->find($id);
|
||||
|
||||
if (!$task) {
|
||||
if (null === $task) {
|
||||
throw $this->createNotFoundException('Unable to find Task entity.');
|
||||
}
|
||||
|
||||
@@ -415,19 +408,24 @@ final class SingleTaskController extends AbstractController
|
||||
}
|
||||
}
|
||||
|
||||
if($task->getContext() instanceof Person){
|
||||
return $this->render('@ChillTask/SingleTask/Person/confirm_delete.html.twig', array(
|
||||
'task' => $task,
|
||||
'delete_form' => $form->createView()
|
||||
));
|
||||
} else {
|
||||
return $this->render('@ChillTask/SingleTask/AccompanyingCourse/confirm_delete.html.twig', array(
|
||||
'task' => $task,
|
||||
'delete_form' => $form->createView(),
|
||||
'accompanyingCourse' => $course
|
||||
));
|
||||
if ($task->getContext() instanceof Person) {
|
||||
return $this->render(
|
||||
'@ChillTask/SingleTask/Person/confirm_delete.html.twig',
|
||||
[
|
||||
'task' => $task,
|
||||
'delete_form' => $form->createView(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'@ChillTask/SingleTask/AccompanyingCourse/confirm_delete.html.twig',
|
||||
[
|
||||
'task' => $task,
|
||||
'delete_form' => $form->createView(),
|
||||
'accompanyingCourse' => $course
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,20 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2018 Champs Libres Cooperative <info@champs-libres.coop>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\TaskBundle\Form;
|
||||
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher;
|
||||
@@ -48,6 +35,9 @@ class SingleTaskType extends AbstractType
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$center = null;
|
||||
$isScopeConcerned = false;
|
||||
|
||||
if (NULL !== $task = $options['data']) {
|
||||
$center = $this->centerResolverDispatcher->resolveCenter($task);
|
||||
$isScopeConcerned = $this->scopeResolverDispatcher->isConcerned($task);
|
||||
@@ -74,8 +64,7 @@ class SingleTaskType extends AbstractType
|
||||
'required' => false
|
||||
]);
|
||||
|
||||
if ($this->parameterBag->get('chill_main')['acl']['form_show_scopes']
|
||||
&& $isScopeConcerned) {
|
||||
if ($isScopeConcerned && $this->parameterBag->get('chill_main')['acl']['form_show_scopes']) {
|
||||
$builder
|
||||
->add('circle', ScopePickerType::class, [
|
||||
'center' => $center,
|
||||
|
Reference in New Issue
Block a user