mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[CoreBundle] Move the PaymentFixture class in a proper namespace
This commit is contained in:
parent
a05d52c818
commit
e7df13958b
3 changed files with 23 additions and 3 deletions
|
|
@ -40,3 +40,4 @@ parameters:
|
|||
- '/Method Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface\:\:supportsNormalization\(\) invoked with 3 parameters\, 1\-2 required\./'
|
||||
- '/(Interface|Class) [a-zA-Z\\]+ specifies template type (\w+) of interface [a-zA-Z\\]+ as [a-zA-Z\\]+ (of [a-zA-Z\\]+ )?but it''s already specified as/' # turns off a weird generics check behavior, we are basing on Psalm for generics checks
|
||||
- '/Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::normalize\(\) invoked with 2 parameters, 1 required./'
|
||||
- '/Class "Sylius\\Bundle\\CoreBundle\\Fixture\\PaymentFixture" not found/'
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sylius\Bundle\CoreBundle\Fixture\Factory;
|
||||
namespace Sylius\Bundle\CoreBundle\Fixture;
|
||||
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Faker\Factory;
|
||||
|
|
@ -24,20 +24,34 @@ use Sylius\Component\Payment\PaymentTransitions;
|
|||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
class_alias(PaymentFixture::class, '\Sylius\Bundle\CoreBundle\Fixture\Factory\PaymentFixture');
|
||||
|
||||
trigger_deprecation(
|
||||
'sylius/core-bundle',
|
||||
'1.13',
|
||||
'The "%s" class is deprecated and will be removed in Sylius 2.0. Use "%s" instead.',
|
||||
'\Sylius\Bundle\CoreBundle\Fixture\Factory\PaymentFixture',
|
||||
PaymentFixture::class,
|
||||
);
|
||||
|
||||
class PaymentFixture extends AbstractFixture
|
||||
{
|
||||
private Generator $faker;
|
||||
|
||||
private OptionsResolver $optionsResolver;
|
||||
|
||||
/**
|
||||
* @param PaymentRepositoryInterface<PaymentInterface> $paymentRepository
|
||||
*/
|
||||
public function __construct(
|
||||
private PaymentRepositoryInterface $paymentRepository,
|
||||
private StateMachineFactoryInterface $stateMachineFactory,
|
||||
private ObjectManager $paymentManager,
|
||||
) {
|
||||
$this->faker = Factory::create();
|
||||
|
||||
$this->optionsResolver = new OptionsResolver();
|
||||
$this->configureOptions($this->optionsResolver);
|
||||
$this->faker = Factory::create();
|
||||
}
|
||||
|
||||
public function getName(): string
|
||||
|
|
@ -45,6 +59,9 @@ class PaymentFixture extends AbstractFixture
|
|||
return 'payments';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $options
|
||||
*/
|
||||
public function load(array $options): void
|
||||
{
|
||||
$options = $this->optionsResolver->resolve($options);
|
||||
|
|
@ -182,11 +182,13 @@
|
|||
<argument type="service" id="sylius.checker.order_payment_method_selection_requirement" />
|
||||
</service>
|
||||
|
||||
<service id="Sylius\Bundle\CoreBundle\Fixture\Factory\PaymentFixture">
|
||||
<service id="Sylius\Bundle\CoreBundle\Fixture\PaymentFixture">
|
||||
<argument type="service" id="sylius.repository.payment" />
|
||||
<argument type="service" id="sm.factory" />
|
||||
<argument type="service" id="sylius.manager.payment" />
|
||||
<tag name="sylius_fixtures.fixture" />
|
||||
</service>
|
||||
|
||||
<service id="Sylius\Bundle\CoreBundle\Fixture\Factory\PaymentFixture" alias="Sylius\Bundle\CoreBundle\Fixture\PaymentFixture" />
|
||||
</services>
|
||||
</container>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue