mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-13 18:24:58 +00:00
Fixed: [budget] remove deprecated config repository and fix summary budget when generating document
This commit is contained in:
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\BudgetBundle\Form;
|
||||
|
||||
use Chill\BudgetBundle\Config\ConfigRepository;
|
||||
use Chill\BudgetBundle\Entity\Charge;
|
||||
use Chill\BudgetBundle\Entity\ChargeKind;
|
||||
use Chill\BudgetBundle\Repository\ChargeKindRepository;
|
||||
@@ -25,13 +24,9 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function array_flip;
|
||||
use function asort;
|
||||
|
||||
class ChargeType extends AbstractType
|
||||
{
|
||||
protected ConfigRepository $configRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private ChargeKindRepository $repository;
|
||||
@@ -39,12 +34,10 @@ class ChargeType extends AbstractType
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
ConfigRepository $configRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ChargeKindRepository $repository,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->configRepository = $configRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->repository = $repository;
|
||||
$this->translator = $translator;
|
||||
@@ -116,19 +109,4 @@ class ChargeType extends AbstractType
|
||||
{
|
||||
return 'chill_budgetbundle_charge';
|
||||
}
|
||||
|
||||
private function getTypes()
|
||||
{
|
||||
$charges = $this->configRepository
|
||||
->getChargesLabels(true);
|
||||
|
||||
// rewrite labels to filter in language
|
||||
foreach ($charges as $key => $labels) {
|
||||
$charges[$key] = $this->translatableStringHelper->localize($labels);
|
||||
}
|
||||
|
||||
asort($charges);
|
||||
|
||||
return array_flip($charges);
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\BudgetBundle\Form;
|
||||
|
||||
use Chill\BudgetBundle\Config\ConfigRepository;
|
||||
use Chill\BudgetBundle\Entity\Resource;
|
||||
use Chill\BudgetBundle\Entity\ResourceKind;
|
||||
use Chill\BudgetBundle\Repository\ResourceKindRepository;
|
||||
@@ -24,12 +23,9 @@ use Symfony\Component\Form\Extension\Core\Type\TextareaType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function array_flip;
|
||||
|
||||
class ResourceType extends AbstractType
|
||||
{
|
||||
protected ConfigRepository $configRepository;
|
||||
|
||||
protected TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
private ResourceKindRepository $repository;
|
||||
@@ -37,12 +33,10 @@ class ResourceType extends AbstractType
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(
|
||||
ConfigRepository $configRepository,
|
||||
TranslatableStringHelperInterface $translatableStringHelper,
|
||||
ResourceKindRepository $repository,
|
||||
TranslatorInterface $translator
|
||||
) {
|
||||
$this->configRepository = $configRepository;
|
||||
$this->translatableStringHelper = $translatableStringHelper;
|
||||
$this->repository = $repository;
|
||||
$this->translator = $translator;
|
||||
@@ -98,19 +92,4 @@ class ResourceType extends AbstractType
|
||||
{
|
||||
return 'chill_budgetbundle_resource';
|
||||
}
|
||||
|
||||
private function getTypes()
|
||||
{
|
||||
$resources = $this->configRepository
|
||||
->getResourcesLabels(true);
|
||||
|
||||
// rewrite labels to filter in language
|
||||
foreach ($resources as $key => $labels) {
|
||||
$resources[$key] = $this->translatableStringHelper->localize($labels);
|
||||
}
|
||||
|
||||
asort($resources);
|
||||
|
||||
return array_flip($resources);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user