Skip to content

Commit

Permalink
Migrate service definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
FabienPapet committed Jan 31, 2023
1 parent 0ede6d4 commit eaeb0d4
Show file tree
Hide file tree
Showing 6 changed files with 511 additions and 1,726 deletions.
Expand Up @@ -40,7 +40,6 @@
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Router;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
Expand All @@ -53,11 +52,6 @@ class OrderStateType extends TranslatorAwareType
*/
private $templates;

/**
* @var Router
*/
private $routing;

/**
* @var array
*/
Expand All @@ -67,7 +61,6 @@ class OrderStateType extends TranslatorAwareType
* @param TranslatorInterface $translator
* @param array $locales
* @param ThemeCatalogInterface $themeCatalog
* @param Router $routing
* @param Configuration $configuration
*
* @throws \PrestaShop\PrestaShop\Core\Exception\InvalidArgumentException
Expand All @@ -76,11 +69,9 @@ public function __construct(
TranslatorInterface $translator,
array $locales,
ThemeCatalogInterface $themeCatalog,
Router $routing,
Configuration $configuration
) {
parent::__construct($translator, $locales);
$this->routing = $routing;
$mailTheme = $configuration->get('PS_MAIL_THEME', 'modern');

$mailLayouts = $themeCatalog->getByName($mailTheme)->getLayouts();
Expand Down
Expand Up @@ -32,6 +32,7 @@
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\Translation\TranslatorInterface;

/**
* This form class is responsible to generate the basic product Warehouse combinations form.
Expand All @@ -43,9 +44,9 @@ class ProductWarehouseCombination extends CommonAbstractType
/**
* Constructor.
*
* @param object $translator
* @param TranslatorInterface $translator
*/
public function __construct($translator)
public function __construct(TranslatorInterface $translator)
{
$this->translator = $translator;
}
Expand Down
Expand Up @@ -28,7 +28,6 @@

namespace PrestaShopBundle\Form\Admin\Sell\Product\Pricing;

use Currency;
use PrestaShopBundle\Form\Admin\Type\IconButtonType;
use PrestaShopBundle\Form\Admin\Type\TranslatorAwareType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
Expand All @@ -46,22 +45,22 @@
class PricingType extends TranslatorAwareType
{
/**
* @var Currency
* @var string
*/
private $defaultCurrency;
private $defaultCurrencyIsoCode;

/**
* @param TranslatorInterface $translator
* @param array $locales
* @param Currency $defaultCurrency
* @param string $defaultCurrencyIsoCode
*/
public function __construct(
TranslatorInterface $translator,
array $locales,
Currency $defaultCurrency
string $defaultCurrencyIsoCode
) {
parent::__construct($translator, $locales);
$this->defaultCurrency = $defaultCurrency;
$this->defaultCurrencyIsoCode = $defaultCurrencyIsoCode;
}

/**
Expand All @@ -80,7 +79,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label_tag_name' => 'h3',
'label_subtitle' => $this->trans('Cost price (tax excl.)', 'Admin.Catalog.Feature'),
'attr' => ['data-display-price-precision' => self::PRESTASHOP_DECIMALS],
'currency' => $this->defaultCurrency->iso_code,
'currency' => $this->defaultCurrencyIsoCode,
'modify_all_shops' => true,
'constraints' => [
new NotBlank(),
Expand Down
Expand Up @@ -28,7 +28,6 @@

namespace PrestaShopBundle\Form\Admin\Sell\Product\Pricing;

use Currency;
use PrestaShopBundle\Form\Admin\Type\TranslatorAwareType;
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
Expand All @@ -46,22 +45,22 @@ class UnitPriceType extends TranslatorAwareType
private const ENABLED_GROUP = 'enabled_group';

/**
* @var Currency
* @var string
*/
private $defaultCurrency;
private $defaultCurrencyIsoCode;

/**
* @param TranslatorInterface $translator
* @param array $locales
* @param Currency $defaultCurrency
* @param string $defaultCurrencyIsoCode
*/
public function __construct(
TranslatorInterface $translator,
array $locales,
Currency $defaultCurrency
string $defaultCurrencyIsoCode
) {
parent::__construct($translator, $locales);
$this->defaultCurrency = $defaultCurrency;
$this->defaultCurrencyIsoCode = $defaultCurrencyIsoCode;
}

/**
Expand All @@ -74,7 +73,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'required' => false,
'label' => $this->trans('Retail price per unit (tax excl.)', 'Admin.Catalog.Feature'),
'attr' => ['data-display-price-precision' => self::PRESTASHOP_DECIMALS],
'currency' => $this->defaultCurrency->iso_code,
'currency' => $this->defaultCurrencyIsoCode,
'constraints' => [
new NotBlank(),
new Type(['type' => 'float']),
Expand All @@ -90,7 +89,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'required' => false,
'label' => $this->trans('Retail price per unit (tax incl.)', 'Admin.Catalog.Feature'),
'attr' => ['data-display-price-precision' => self::PRESTASHOP_DECIMALS],
'currency' => $this->defaultCurrency->iso_code,
'currency' => $this->defaultCurrencyIsoCode,
'constraints' => [
new NotBlank(),
new Type(['type' => 'float']),
Expand Down

0 comments on commit eaeb0d4

Please sign in to comment.