<commit_before><?php declare(strict_types=1);
/**
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2017-2019, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\ContentBundle\DependencyInjection\Compiler;

use Knp\DoctrineBehaviors\EventSubscriber\TranslatableEventSubscriber;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Disable KNP translatable event subscriber compiler pass
 */
class DisableKnpTranslatableSubscriberPass implements CompilerPassInterface
{
    /**
     * {@inheritDoc}
     */
    public function process(ContainerBuilder $container): void
    {
        if ($container->hasDefinition(TranslatableEventSubscriber::class)) {
            $container->getDefinition(TranslatableEventSubscriber::class)->clearTag('doctrine.event_subscriber');
        }
    }
}
<commit_msg>Fix disabling KNP translatable event subscriber compiler pass.<commit_after><?php declare(strict_types=1);
/**
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2017-2019, Darvin Studio
 * @link      https://www.darvin-studio.ru
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Darvin\ContentBundle\DependencyInjection\Compiler;

use Knp\DoctrineBehaviors\EventSubscriber\TranslatableEventSubscriber;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Disable KNP translatable event subscriber compiler pass
 */
class DisableKnpTranslatableSubscriberPass implements CompilerPassInterface
{
    /**
     * {@inheritDoc}
     */
    public function process(ContainerBuilder $container): void
    {
        if ($container->hasDefinition(TranslatableEventSubscriber::class)) {
            $container->getDefinition('darvin_content.translatable.event_subscriber.map')
                ->setDecoratedService(TranslatableEventSubscriber::class);
        }
    }
}

{'fraction_non_alphanumeric': 0.0984573502722323, 'fraction_numerical': 0.008166969147005444, 'mean_word_length': 4.568181818181818, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1464298', 'n_tokens_mistral': 603, 'n_tokens_neox': 585, 'n_words': 128}