<commit_before><?php

namespace Oro\Bundle\PlatformBundle\DependencyInjection;

use Oro\Component\DependencyInjection\ExtendedContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Checks whether an additional unnamed DBAL configuration exists,
 * and if so, adds it for all DBAL connections that have the same driver, DB name, host and port
 * as a default DBAL connection.
 * This is required because DoctrineBundle adds unnamed DBAL configuration only to a default DBAL connection.
 * @see \Doctrine\Bundle\DoctrineBundle\DependencyInjection\Configuration::addDbalSection
 * For example, if the following configuration is added to an application configuration file:
 * <code>
 *  doctrine:
 *      dbal:
 *          charset: utf8mb4
 *          default_table_options:
 *              charset: utf8mb4
 *              collate: utf8mb4_unicode_ci
 * </code>
 * and there is DBAL connection named "another" that has the same driver, DB name, host and port
 * as a default DBAL connection, the following additional configuration will be added:
 * <code>
 *  doctrine:
 *      dbal:
 *          connections:
 *              another:
 *                  charset: utf8mb4
 *                  default_table_options:
 *                      charset: utf8mb4
 *                      collate: utf8mb4_unicode_ci
 * </code>
 * this assitional configuration will be added just before the unnamed DBAL configuration
 * to be able to override any of the added options for a specific DBAL connection.
 */
class DbalConfigurationLoader
{
    /**
     * @param ContainerBuilder $container
     */
    public static function load(ContainerBuilder $container): void
    {
        if (!$container instanceof ExtendedContainerBuilder) {
            return;
        }
        $doctrineConfig = $container->getExtensionConfig('doctrine');
        $commonConfig = self::getCommonDbalConfig($doctrineConfig);<commit_msg>BAP-16436: Not possible to install application on DB with utf8mb4<commit_after><?php

namespace Oro\Bundle\PlatformBundle\DependencyInjection;

use Oro\Component\DependencyInjection\ExtendedContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Checks whether an additional unnamed DBAL configuration exists,
 * and if so, adds it for all DBAL connections that have the same driver, DB name, host and port
 * as a default DBAL connection.
 * This is required because DoctrineBundle adds unnamed DBAL configuration only to a default DBAL connection.
 * @see \Doctrine\Bundle\DoctrineBundle\DependencyInjection\Configuration::addDbalSection
 * For example, if the following configuration is added to an application configuration file:
 * <code>
 *  doctrine:
 *      dbal:
 *          charset: utf8mb4
 *          default_table_options:
 *              charset: utf8mb4
 *              collate: utf8mb4_unicode_ci
 * </code>
 * and there is DBAL connection named "another" that has the same driver, DB name, host and port
 * as a default DBAL connection, the following additional configuration will be added:
 * <code>
 *  doctrine:
 *      dbal:
 *          connections:
 *              another:
 *                  charset: utf8mb4
 *                  default_table_options:
 *                      charset: utf8mb4
 *                      collate: utf8mb4_unicode_ci
 * </code>
 * this additional configuration will be added just before the unnamed DBAL configuration
 * to be able to override any of the added options for a specific DBAL connection.
 */
class DbalConfigurationLoader
{
    /**
     * @param ContainerBuilder $container
     */
    public static function load(ContainerBuilder $container): void
    {
        if (!$container instanceof ExtendedContainerBuilder) {
            return;
        }
        $doctrineConfig = $container->getExtensionConfig('doctrine');
        $commonConfig = self::getCommonDbalConfig($doctrineConfig);
{'fraction_non_alphanumeric': 0.07011258955987718, 'fraction_numerical': 0.007932446264073694, 'mean_word_length': 3.0010235414534288, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '7062274', 'n_tokens_mistral': 994, 'n_tokens_neox': 966, 'n_words': 346}