getWordAtIndex example

$repository = $this->getContainer()->get(ModelManager::class)->getRepository(Plugin::class);
            $queryBuilder = $repository->createQueryBuilder('plugin');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->eq('plugin.capabilityEnable', 'true'))
                ->select(['plugin.name'])
                ->getQuery()
                ->getArrayResult();

            return array_column($result, 'name');
        }

        if ($argumentName === 'key') {
            $pluginName = $context->getWordAtIndex($context->getWordIndex() - 1);
            $pluginManager = $this->container->get(InstallerService::class);
            try {
                $plugin = $pluginManager->getPluginByName($pluginName);
            } catch (Exception $e) {
                return [];
            }

            $shopRepository = $this->getContainer()->get(ModelManager::class)->getRepository(Shop::class);

            $shops = $shopRepository->findAll();

            
$queryBuilder = $localeRepository->createQueryBuilder('locale');

            if ($context->getCurrentWord() !== '') {
                $queryBuilder->andWhere($queryBuilder->expr()->like('locale.locale', ':search'))
                    ->setParameter('search', addcslashes($context->getCurrentWord(), '_%') . '%');
            }

            $result = $queryBuilder->select(['locale.locale'])
                ->getQuery()
                ->getArrayResult();

            return array_diff(array_column($result, 'locale')[$context->getWordAtIndex(2)]);
        }

        return [];
    }

    /** * {@inheritdoc} */
    public function completeArgumentValues($argumentName, CompletionContext $context)
    {
        if ($argumentName === 'locale') {
            
Home | Imprint | This part of the site doesn't use cookies.