triggerDeprecationOrThrow example

use Symfony\Contracts\Translation\LocaleAwareInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

#[Package('core')] abstract class AbstractTranslator implements TranslatorInterface, TranslatorBagInterface, LocaleAwareInterface, ResetInterface
{
    /** * @deprecated tag:v6.6.0 - Will be removed, use `reset` instead */
    public function resetInMemoryCache(): void
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0', 'Use reset instead')
        );

        $this->reset();
    }

    /** * @param string $cacheDir */
    public function warmUp($cacheDir): void
    {
public function __construct(private readonly iterable $converters)
    {
    }

    /** * @param array<string, mixed> $payload * * @return array<string, mixed> */
    public function convert(string $entityName, array $payload): array
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedClassMessage(__CLASS__, 'v6.6.0.0')
        );

        foreach ($this->converters as $converter) {
            $payload = $converter->convert($entityName$payload);
        }

        return $payload;
    }

    
$this->lazyLoad(...)
        );
    }

    /** * @param array<int, mixed> $args * * @deprecated tag:v6.6.0 - Will be removed in v6.6.0.0 */
    public function load(array $args): ?OrderTransactionEntity
    {
        Feature::triggerDeprecationOrThrow(
            'v6_6_0_0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, '6.6.0.0')
        );

        [$id$context] = $args;
        $criteria = new Criteria([$id]);

        return $this->loadOrderTransaction($criteria$context$id);
    }

    private function lazyLoad(StorableFlow $storableFlow): ?OrderTransactionEntity
    {
use Shopware\Core\Framework\Log\Package;
use Symfony\Component\HttpFoundation\Response;

/** * @deprecated tag:v6.6.0 - will be removed, use MediaException::mediaNotFound instead */
#[Package('buyers-experience')] class MediaNotFoundException extends MediaException
{
    public function __construct(string $mediaId)
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedClassMessage(self::class, 'v6.6.0.0', 'use MediaException::mediaNotFound instead')
        );

        parent::__construct(
            Response::HTTP_NOT_FOUND,
            self::MEDIA_NOT_FOUND,
            'Media for id {{ mediaId }} not found.',
            ['mediaId' => $mediaId]
        );
    }

    
/** * @param array<string, mixed> $stored * * @return array<string, mixed> */
    public function store(FlowEventAware $event, array $stored): array
    {
        if (Feature::isActive('v6.6.0.0')) {
            return $stored;
        }

        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0', 'Use ScalarValuesStorer instead')
        );

        if (!$event instanceof ReviewFormDataAware || isset($stored[ReviewFormDataAware::REVIEW_FORM_DATA])) {
            return $stored;
        }

        $stored[ReviewFormDataAware::REVIEW_FORM_DATA] = $event->getReviewFormData();

        return $stored;
    }
use Shopware\Core\Framework\ShopwareHttpException;
use Symfony\Component\HttpFoundation\Response;

/** * @deprecated tag:v6.6.0 - reason:becomes-internal - Use PromotionException::codeAlreadyRedeemed instead */
#[Package('buyers-experience')] class CodeAlreadyRedeemedException extends ShopwareHttpException
{
    public function __construct(string $code)
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0', 'Use PromotionException::codeAlreadyRedeemed instead')
        );

        parent::__construct('Promotion with code "{{ code }}" has already been marked as redeemed!', ['code' => $code]);
    }

    public function getErrorCode(): string
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            
/** * @param array<string, mixed> $stored * * @return array<string, mixed> */
    public function store(FlowEventAware $event, array $stored): array
    {
        if (Feature::isActive('v6.6.0.0')) {
            return $stored;
        }

        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0', 'Use ScalarValuesStorer instead')
        );

        if (!$event instanceof ContactFormDataAware || isset($stored[ContactFormDataAware::CONTACT_FORM_DATA])) {
            return $stored;
        }

        $stored[ContactFormDataAware::CONTACT_FORM_DATA] = $event->getContactFormData();

        return $stored;
    }

    public function __construct(array $data)
    {
        foreach ($data as $property => $value) {
            $this->$property = $value;
        }
    }

    public function getName(): ?string
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0', '\Shopware\Core\Framework\App\Flow\Action\Xml\InputField')
        );

        return $this->name;
    }

    /** * @return array<string, string>|null */
    public function getLabel(): ?array
    {

#[Package('storefront')] class NoStore
{
    final public const ALIAS = 'noStore';

    public function getAliasName(): string
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedClassMessage(self::class, 'v6.6.0.0')
        );

        return self::ALIAS;
    }

    public function allowArray(): bool
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            
$message,
            $parameters,
            $e
        );
    }

    /** * @deprecated tag:v6.6.0 - will be removed. Use StoreException::extensionNotFoundFromTechnicalName */
    public static function fromTechnicalName(string $technicalName): self
    {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0', 'Use StoreException::extensionNotFoundFromTechnicalName instead.')
        );

        return new self(
            'Could not find extension with technical name "{{technicalName}}".',
            ['technicalName' => $technicalName]
        );
    }

    /** * @deprecated tag:v6.6.0 - will be removed. Use StoreException::extensionNotFoundFromId */
/** * @param array<string, mixed> $stored * * @return array<string, mixed> */
    public function store(FlowEventAware $event, array $stored): array
    {
        if (Feature::isActive('v6.6.0.0')) {
            return $stored;
        }

        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedMethodMessage(self::class, __METHOD__, 'v6.6.0.0', 'Use ScalarValuesStorer instead')
        );

        if (!$event instanceof ContextTokenAware || isset($stored[ContextTokenAware::CONTEXT_TOKEN])) {
            return $stored;
        }

        $stored[ContextTokenAware::CONTEXT_TOKEN] = $event->getContextToken();

        return $stored;
    }
return $this->createActionResponse($request);
                        }

                        if ($e->getErrorCode() !== CartException::CART_LINE_ITEM_TYPE_NOT_SUPPORTED_CODE) {
                            throw $e;
                        }

                        /** * @deprecated tag:v6.6.0 - remove complete catch below and just leave the try content */
                        Feature::triggerDeprecationOrThrow(
                            'v6.6.0.0',
                            'With Shopware 6.6.0.0, you will only be able to create line items only with registered LineItemFactories',
                        );

                        $lineItem = new LineItem(
                            $lineItemData->getAlnum('id'),
                            $lineItemData->getAlnum('type'),
                            $lineItemData->get('referencedId'),
                            $lineItemData->getInt('quantity', 1)
                        );

                        
public function getDecorated(): AbstractAvailableThemeProvider
    {
        throw new DecorationPatternException(self::class);
    }

    /** * @deprecated tag:v6.6.0 - Second parameter $activeOnly will be required in future versions. */
    public function load(Context $context, bool $activeOnly = false): array
    {
        if (\count(\func_get_args()) === 1) {
            Feature::triggerDeprecationOrThrow(
                'v6_6_0_0',
                sprintf(
                    'Method %s::%s is deprecated. Second parameter $activeOnly will be required in future versions.',
                    __CLASS__,
                    __METHOD__,
                )
            );
        }

        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('typeId', Defaults::SALES_CHANNEL_TYPE_STOREFRONT));

        
/** * @internal */
    public function __construct(
        private readonly AdapterInterface $cache
    ) {
    }

    public function store(array $tags): void
    {
        Feature::triggerDeprecationOrThrow('v6.6.0.0', 'The CacheInvalidatorStorage is unsafe for multi-server use, please use the RedisInvalidatorStorage instead');

        $item = $this->cache->getItem(self::CACHE_KEY);

        $values = CacheCompressor::uncompress($item) ?? [];

        foreach ($tags as $tag) {
            $values[$tag] = '1';
        }

        $item = CacheCompressor::compress($item$values);

        
/** * @deprecated tag:v6.6.0 - will be removed, use RoutingException::missingRequestParameter instead */
#[Package('core')] class MissingRequestParameterException extends RoutingException
{
    public function __construct(
        private readonly string $name,
        private readonly string $path = ''
    ) {
        Feature::triggerDeprecationOrThrow(
            'v6.6.0.0',
            Feature::deprecatedClassMessage(self::class, 'v6.6.0.0', 'use RoutingException::missingRequestParameter instead')
        );

        parent::__construct(
            Response::HTTP_BAD_REQUEST,
            self::MISSING_REQUEST_PARAMETER_CODE,
            'Parameter "{{ parameterName }}" is missing.',
            ['parameterName' => $name]
        );
    }

    
Home | Imprint | This part of the site doesn't use cookies.