mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 23:53:50 +00:00
Fixes for feature "Regroupment of center"
* allow more than 15 character in regroupment name * remove unused methods in PickCenterType * show only active Regroupment in form * remove dead code and commented code
This commit is contained in:
@@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Entity\Regroupment;
|
||||
use Chill\MainBundle\Export\ExportManager;
|
||||
use Chill\MainBundle\Form\DataMapper\ExportPickCenterDataMapper;
|
||||
use Chill\MainBundle\Repository\RegroupmentRepository;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
@@ -29,29 +30,28 @@ use function count;
|
||||
/**
|
||||
* Pick centers amongst available centers for the user.
|
||||
*/
|
||||
class PickCenterType extends AbstractType
|
||||
final class PickCenterType extends AbstractType
|
||||
{
|
||||
public const CENTERS_IDENTIFIERS = 'c';
|
||||
|
||||
protected AuthorizationHelperInterface $authorizationHelper;
|
||||
private AuthorizationHelperInterface $authorizationHelper;
|
||||
|
||||
protected ExportManager $exportManager;
|
||||
private ExportManager $exportManager;
|
||||
|
||||
protected UserInterface $user;
|
||||
private RegroupmentRepository $regroupmentRepository;
|
||||
|
||||
private UserInterface $user;
|
||||
|
||||
public function __construct(
|
||||
TokenStorageInterface $tokenStorage,
|
||||
ExportManager $exportManager,
|
||||
RegroupmentRepository $regroupmentRepository,
|
||||
AuthorizationHelperInterface $authorizationHelper
|
||||
) {
|
||||
$this->exportManager = $exportManager;
|
||||
$this->user = $tokenStorage->getToken()->getUser();
|
||||
$this->authorizationHelper = $authorizationHelper;
|
||||
}
|
||||
|
||||
public function addGroupingCenter(GroupingCenterInterface $grouping)
|
||||
{
|
||||
$this->groupingCenters[md5($grouping->getName())] = $grouping;
|
||||
$this->regroupmentRepository = $regroupmentRepository;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
@@ -71,13 +71,14 @@ class PickCenterType extends AbstractType
|
||||
'choice_label' => static function (Center $c) {
|
||||
return $c->getName();
|
||||
},
|
||||
'data' => count($this->groupingCenters) > 0 ? null : $centers,
|
||||
'data' => $centers,
|
||||
])
|
||||
->add('regroupment', EntityType::class, [
|
||||
'class' => Regroupment::class,
|
||||
'label' => 'regroupment',
|
||||
'multiple' => true,
|
||||
'expanded' => true,
|
||||
'choices' => $this->regroupmentRepository->findAllActive(),
|
||||
'choice_label' => static function (Regroupment $r) {
|
||||
return $r->getName();
|
||||
},
|
||||
|
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
namespace Chill\MainBundle\Form\Type\Export;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
||||
class PickRegroupmentType extends AbstractType
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user