Fixed: [budget] remove deprecated config repository and fix summary budget when generating document

This commit is contained in:
2023-01-31 19:41:43 +01:00
parent 885256ac0d
commit de55ff920f
8 changed files with 61 additions and 253 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}