mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
[export form] decouple data from PickCenter form
This commit is contained in:
37
src/Bundle/ChillMainBundle/Export/ExportFormHelper.php
Normal file
37
src/Bundle/ChillMainBundle/Export/ExportFormHelper.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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\Export;
|
||||
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperForCurrentUserInterface;
|
||||
|
||||
final readonly class ExportFormHelper
|
||||
{
|
||||
public function __construct(
|
||||
private ExportManager $exportManager,
|
||||
private AuthorizationHelperForCurrentUserInterface $authorizationHelper,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<"centers"> $steps
|
||||
*/
|
||||
public function getDefaultData(string $step, ExportInterface $export): array
|
||||
{
|
||||
$data = [];
|
||||
|
||||
if ($step === 'centers') {
|
||||
$data['centers'] = $this->authorizationHelper->getReachableCenters($export->requiredRole());
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user