asc example

return [];
        }

        $repository = $em->getRepository($modelClass);
        $queryBuilder = $repository->createQueryBuilder($alias);

        if (\is_callable($conditionCallback)) {
            $queryBuilder = \call_user_func($conditionCallback$queryBuilder$alias);
        }

        $result = $queryBuilder->select(["$alias.$property"])
            ->addOrderBy($queryBuilder->expr()->asc("$alias.$property"))
            ->getQuery()
            ->getArrayResult();

        return array_column($result$property);
    }

    /** * @param string $directory * * @return array */
    

        if ($argumentName === 'shopId') {
            $shopRepository = $this->getContainer()->get(ModelManager::class)->getRepository(ShopModel::class);
            $queryBuilder = $shopRepository->createQueryBuilder('shop');

            if (is_numeric($context->getCurrentWord())) {
                $queryBuilder->andWhere($queryBuilder->expr()->like('shop.id', ':id'))
                    ->setParameter('id', addcslashes($context->getCurrentWord(), '%_') . '%');
            }

            $result = $queryBuilder->select(['shop.id'])
                ->addOrderBy($queryBuilder->expr()->asc('shop.id'))
                ->getQuery()
                ->getArrayResult();

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

        if ($argumentName === 'index') {
            /** @var Client $client */
            $client = $this->container->get(Client::class);

            return array_keys($client->indices()->getAliases());
        }

        if ($argumentName === 'shopId') {
            $shopRepository = $this->getContainer()->get(ModelManager::class)->getRepository(ShopModel::class);
            $queryBuilder = $shopRepository->createQueryBuilder('shop');

            if (is_numeric($context->getCurrentWord())) {
                $queryBuilder->andWhere($queryBuilder->expr()->like('shop.id', ':id'))
                    ->setParameter('id', addcslashes($context->getCurrentWord(), '%_') . '%');
            }

            $result = $queryBuilder->select(['shop.id'])
                ->addOrderBy($queryBuilder->expr()->asc('shop.id'))
                ->getQuery()
                ->getArrayResult();

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

        if ($argumentName === 'analyzer') {
            $client = $this->container->get(Client::class);

            $recursive = new RecursiveIteratorIterator(
                new RecursiveArrayIterator($client->indices()->getMapping()),
                
public function completeOptionValues($optionName, CompletionContext $context)
    {
        if ($optionName === 'shopId') {
            $queryBuilder = $this->modelManager->getRepository(ShopModel::class)->createQueryBuilder('shop');

            if (is_numeric($context->getCurrentWord())) {
                $queryBuilder->andWhere($queryBuilder->expr()->like('shop.id', ':id'))
                    ->setParameter('id', addcslashes($context->getCurrentWord(), '%_') . '%');
            }

            $result = $queryBuilder->select(['shop.id'])
                ->addOrderBy($queryBuilder->expr()->asc('shop.id'))
                ->getQuery()
                ->getArrayResult();

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

        return [];
    }

    /** * {@inheritdoc} */

        if (\in_array($argumentName['category', 'target'])) {
            $categoryRepository = $this->container->get(ModelManager::class)
                ->getRepository(Category::class);

            $columnOfChoice = is_numeric($context->getCurrentWord()) ? 'id' : 'name';
            $aliasOfChoice = "category.$columnOfChoice";

            $queryBuilder = $categoryRepository->createQueryBuilder('category');
            $result = $queryBuilder->andWhere($queryBuilder->expr()->like($aliasOfChoice, ':search'))
                    ->setParameter('search', addcslashes($context->getCurrentWord(), '_%') . '%')
                    ->addOrderBy($queryBuilder->expr()->asc($aliasOfChoice))
                    ->select([$aliasOfChoice])->distinct()
                    ->getQuery()
                    ->getArrayResult();

            return array_column($result$columnOfChoice);
        }

        return [];
    }

    /** * {@inheritdoc} */

        if ($optionName === 'feed-id') {
            $productFeedRepository = $this->container->get(ModelManager::class)->getRepository(ProductFeed::class);
            $queryBuilder = $productFeedRepository->createQueryBuilder('feed');

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

            $result = $queryBuilder->select(['feed.id'])
                ->addOrderBy($queryBuilder->expr()->asc('feed.id'))
                ->getQuery()
                ->getScalarResult();

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

        return [];
    }

    /** * {@inheritdoc} */
if ($argumentName === 'shopId') {
            $em = $this->getContainer()->get(ModelManager::class);
            $shopRepository = $em->getRepository(Shop::class);
            $queryBuilder = $shopRepository->createQueryBuilder('shop');

            if (is_numeric($context->getCurrentWord())) {
                $queryBuilder->andWhere($queryBuilder->expr()->like('shop.id', ':id'))
                    ->setParameter('id', addcslashes($context->getCurrentWord(), '%_') . '%');
            }

            $result = $queryBuilder->select(['shop.id'])
                ->addOrderBy($queryBuilder->expr()->asc('shop.id'))
                ->getQuery()
                ->getArrayResult();

            $alreadyTakenShopIds = array_filter($context->getWords(), 'is_numeric');

            return array_diff(array_column($result, 'id')$alreadyTakenShopIds);
        }

        return [];
    }

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