ShopwareStyle example

InputOption::VALUE_NONE,
                'Additionally checks that physical files for existing thumbnails are present'
            )
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->io = new ShopwareStyle($input$output);
        $context = Context::createDefaultContext();

        $this->initializeCommand($input$context);

        /** @var RepositoryIterator<MediaCollection> $mediaIterator */
        $mediaIterator = new RepositoryIterator($this->mediaRepository, $context$this->createCriteria());

        if (!$this->isAsync) {
            $this->generateSynchronous($mediaIterator$context);
        } else {
            $this->generateAsynchronous($mediaIterator$context);
        }

    protected function configure(): void
    {
        $this->addOption('no-queue', null, null, 'Do not use the queue for indexing');
        $this->addOption('skip', null, InputArgument::OPTIONAL, 'Comma separated list of entity names to be skipped');
        $this->addOption('only', null, InputArgument::OPTIONAL, 'Comma separated list of entity names to be generated');
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->io = new ShopwareStyle($input$output);

        $skip = \is_string($input->getOption('skip')) ? explode(',', $input->getOption('skip')) : [];
        $only = \is_string($input->getOption('only')) ? explode(',', $input->getOption('only')) : [];

        $this->registry->iterate(
            new AdminIndexingBehavior(
                (bool) $input->getOption('no-queue'),
                $skip,
                $only
            )
        );

        

    protected function configure(): void
    {
        $this->addOption('skipPluginList', 's', InputOption::VALUE_NONE, 'Don\'t display plugin list after refresh');
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new ShopwareStyle($input$output);
        $io->title('Shopware Plugin Service');
        $context = Context::createDefaultContext();

        $composerInput = clone $input;
        $composerInput->setInteractive(false);
        $helperSet = $this->getHelperSet();
        \assert($helperSet instanceof HelperSet);
        $errors = $this->pluginService->refreshPlugins($contextnew ConsoleIO($composerInput$output$helperSet));
        $io->success('Plugin list refreshed');

        if (\count($errors) !== 0) {
            
class UninstallAppCommand extends Command
{
    public function __construct(
        private readonly AbstractAppLifecycle $appLifecycle,
        private readonly EntityRepository $appRepository
    ) {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new ShopwareStyle($input$output);

        $name = $input->getArgument('name');

        if (!\is_string($name)) {
            throw new \InvalidArgumentException('Argument $name must be an string');
        }

        $context = Context::createDefaultContext();
        $app = $this->getAppByName($name$context);

        if (!$app) {
            
/** * {@inheritdoc} */
    protected function configure(): void
    {
        $this
            ->addArgument('term', InputArgument::REQUIRED);
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->io = new ShopwareStyle($input$output);

        $term = $input->getArgument('term');

        $iteration = $this->getAnalyzers();

        $rows = [];
        foreach ($iteration as $headline => $analyzers) {
            $rows[] = [$headline];
            $rows[] = ['###############'];
            foreach ($analyzers as $analyzer) {
                /** @var array{'tokens': array{token: string}[]} $analyzed */
                

        $this->addOption('shop-name', null, InputOption::VALUE_REQUIRED, 'The name of your shop')
            ->addOption('shop-email', null, InputOption::VALUE_REQUIRED, 'Shop email address')
            ->addOption('shop-locale', null, InputOption::VALUE_REQUIRED, 'Default language locale of the shop')
            ->addOption('shop-currency', null, InputOption::VALUE_REQUIRED, 'Iso code for the default currency of the shop')
            ->addOption('no-interaction', 'n', InputOption::VALUE_NONE, 'Run command in non-interactive mode')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output = new ShopwareStyle($input$output);

        $this->shopConfigurator->updateBasicInformation($input->getOption('shop-name')$input->getOption('shop-email'));

        $output->writeln('Shop configured successfully');
        $output->writeln('');

        if ($input->getOption('shop-locale')) {
            if (!$input->getOption('no-interaction')) {
                if (!$output->confirm('Changing the shops default locale after the fact can be destructive. Are you sure you want to continue', false)) {
                    $output->writeln('Aborting due to user input');

                    

    /** * @internal */
    public function __construct(private readonly DefinitionValidator $validator)
    {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new ShopwareStyle($input$output);
        $io->title('Data Abstraction Layer Validation');

        $errors = 0;
        if ($io->isVerbose()) {
            $io->title('Checking for notices in entity definitions');
            $errors += $this->runNotices($io);
        }

        $io->title('Checking for errors in entity definitions');
        $errors += $this->runErrors($io);

        

    protected function configure(): void
    {
        $this->addOption('use-queue', null, InputOption::VALUE_NONE, 'Ignore cache and force generation')
            ->addOption('skip', null, InputArgument::OPTIONAL, 'Comma separated list of indexer names to be skipped')
            ->addOption('only', null, InputArgument::OPTIONAL, 'Comma separated list of indexer names to be generated')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->io = new ShopwareStyle($input$output);

        $skip = \is_string($input->getOption('skip')) ? explode(',', (string) $input->getOption('skip')) : [];
        $only = \is_string($input->getOption('only')) ? explode(',', (string) $input->getOption('only')) : [];

        $this->registry->index($input->getOption('use-queue')$skip$only);

        $skipEntities = array_map(fn ($indexer) => str_replace('.indexer', '', (string) $indexer)$skip);

        $onlyEntities = array_map(fn ($indexer) => str_replace('.indexer', '', (string) $indexer)$only);

        $event = new RefreshIndexEvent(!$input->getOption('use-queue')$skipEntities$onlyEntities);
        

#[Package('core')] class SystemUpdatePrepareCommand extends Command
{
    public function __construct(private readonly ContainerInterface $container)
    {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $output = new ShopwareStyle($input$output);

        $dsn = trim((string) EnvironmentHelper::getVariable('DATABASE_URL', getenv('DATABASE_URL')));
        if ($dsn === '') {
            $output->note('Environment variable \'DATABASE_URL\' not defined. Skipping ' . $this->getName() . '...');

            return self::SUCCESS;
        }

        $output->writeln('Run Update preparations');

        $context = Context::createDefaultContext();
        
protected function configure(): void
    {
        $this
            ->addArgument('username', InputArgument::REQUIRED)
            ->addOption('password', 'p', InputOption::VALUE_REQUIRED, 'New password for the user')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new ShopwareStyle($input$output);
        $context = Context::createDefaultContext();

        $username = $input->getArgument('username');
        $password = $input->getOption('password');

        if (!$password) {
            $passwordQuestion = new Question('Enter new password for user');
            $passwordQuestion->setValidator(static function D$value): string {
                if ($value === null || trim($value) === '') {
                    throw new \RuntimeException('The password cannot be empty');
                }

                
->addOption('firstName', null, InputOption::VALUE_REQUIRED, 'The user\'s firstname')
            ->addOption('lastName', null, InputOption::VALUE_REQUIRED, 'The user\'s lastname')
            ->addOption('email', null, InputOption::VALUE_REQUIRED, 'E-Mail for the user')
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new ShopwareStyle($input$output);

        $username = $input->getArgument('username');
        $password = $input->getOption('password');

        if (!$password) {
            $passwordQuestion = new Question('Enter password for user');
            $passwordQuestion->setValidator(static function D$value): string {
                if ($value === null || trim($value) === '') {
                    throw new \RuntimeException('The password cannot be empty');
                }

                
'Activate the app after installing it'
            )->addOption(
                'no-validate',
                null,
                InputOption::VALUE_NONE,
                'Skip app validation.'
            );
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new ShopwareStyle($input$output);

        $context = Context::createDefaultContext();

        $refreshableApps = $this->appService->getRefreshableAppInfo($context);
        $requestedApps = $input->getArgument('name');

        if (\count($requestedApps)) {
            $refreshableApps = $refreshableApps->filter($requestedApps);
        }

        if ($refreshableApps->isEmpty()) {
            
$this->addArgument('zip-file', InputArgument::REQUIRED, 'Zip file that contains a shopware platform plugin.')
            ->addOption('no-refresh', null, InputOption::VALUE_OPTIONAL, 'Do not refresh plugin list.')
            ->addOption('delete', null, InputOption::VALUE_OPTIONAL, 'Delete the zip file after importing successfully.');
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $zipFile = $input->getArgument('zip-file');
        $io = new ShopwareStyle($input$output);
        $io->title('Shopware Plugin Zip Import');

        try {
            $type = $this->pluginManagementService->extractPluginZip($zipFile(bool) $input->getOption('delete'));
        } catch (NoPluginFoundInZipException $e) {
            $io->error($e->getMessage());

            return self::FAILURE;
        }

        if ($type === PluginManagementService::PLUGIN) {
            
->addOption('typeId', null, InputOption::VALUE_OPTIONAL, 'Sales channel type id')
            ->addOption('customerGroupId', null, InputOption::VALUE_REQUIRED, 'Default customer group')
            ->addOption('navigationCategoryId', null, InputOption::VALUE_REQUIRED, 'Default Navigation Category')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $id = $input->getOption('id');
        $typeId = $input->getOption('typeId');

        $io = new ShopwareStyle($input$output);

        try {
            $accessKey = $this->salesChannelCreator->createSalesChannel(
                $id,
                $input->getOption('name') ?? 'Headless',
                $typeId ?? $this->getTypeId(),
                $input->getOption('languageId'),
                $input->getOption('currencyId'),
                $input->getOption('paymentMethodId'),
                $input->getOption('shippingMethodId'),
                $input->getOption('countryId'),
                
// The CI validator returns an empty response if the schema is valid         // The public Web validator returns an object with an empty (schemaValidation)Messages array         $messages = array_merge(
            $content['messages'] ?? [],
            $content['schemaValidationMessages'] ?? []
        );

        if (\count($messages) === 0) {
            return Command::SUCCESS;
        }

        $style = new ShopwareStyle($input$output);
        $this->renderErrorMessages($style$messages);

        return Command::FAILURE;
    }

    /** * @param array<string, string|array<mixed>> $messages */
    private function renderErrorMessages(ShopwareStyle $style, array $messages): void
    {
        $style->error('The OpenAPI schema is invalid:');
        
Home | Imprint | This part of the site doesn't use cookies.