[export form] decouple data from PickCenter form

This commit is contained in:
2023-06-01 14:02:48 +02:00
parent 77f8cf0e1a
commit d1e1b1c4ce
5 changed files with 68 additions and 24 deletions

View 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;
}
}