addSource example



            return $terms;
        }

        $composite = new CompositeAggregation($aggregation->getName());

        $accessor = $this->buildAccessor($definition$aggregation->getSorting()->getField()$context);

        $sorting = new Bucketing\TermsAggregation($aggregation->getName() . '.sorting', $accessor);
        $sorting->addParameter('order', $aggregation->getSorting()->getDirection());
        $composite->addSource($sorting);

        $terms = new Bucketing\TermsAggregation($aggregation->getName() . '.key', $fieldName);
        $composite->addSource($terms);

        if ($nested = $aggregation->getAggregation()) {
            $composite->addAggregation(
                $this->parseNestedAggregation($nested$definition$context)
            );
        }

        // set default size to 10.000 => max for default configuration

    public function __construct(
        private readonly Connection $connection,
        private readonly MigrationRuntime $migrationRuntime,
        iterable $migrationSources = [],
        private readonly ?LoggerInterface $logger = null
    ) {
        foreach ($migrationSources as $migrationSource) {
            $this->addSource($migrationSource);
        }
    }

    public function addSource(MigrationSource $migrationSource): void
    {
        $this->migrationSources[$migrationSource->getName()] = $migrationSource;
    }

    /** * @throws UnknownMigrationSourceException * @throws InvalidMigrationClassException */
use Symfony\Component\DependencyInjection\ContainerInterface;

trait MigrationTestBehaviour
{
    /** * @before */
    public function addMigrationSources(): void
    {
        $loader = $this->getContainer()->get(MigrationCollectionLoader::class);

        $loader->addSource(
            new MigrationSource(
                '_test_migrations_invalid_namespace',
                [__DIR__ . '/_test_migrations_invalid_namespace' => 'Shopware\Core\Framework\Test\Migration\_test_migrations_invalid_namespace']
            )
        );

        $loader->addSource(
            new MigrationSource(
                '_test_migrations_valid',
                [__DIR__ . '/_test_migrations_valid' => 'Shopware\Core\Framework\Test\Migration\_test_migrations_valid']
            )
        );
$pluginBaseClass->getPath() . str_replace(
                $pluginBaseClass->getNamespace(),
                '',
                $pluginBaseClass->getMigrationNamespace()
            )
        );

        if (!is_dir($migrationPath)) {
            return $this->migrationLoader->collect('null');
        }

        $this->migrationLoader->addSource(new MigrationSource($pluginBaseClass->getName()[
            $migrationPath => $pluginBaseClass->getMigrationNamespace(),
        ]));

        $collection = $this->migrationLoader
            ->collect($pluginBaseClass->getName());

        $collection->sync();

        return $collection;
    }

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