getBaseListQuery example

if (!\in_array($this->Request()->getActionName()['index', 'load', 'validateEmail'])) {
            $this->Front()->Plugins()->Json()->setRenderer(true);
        }
    }

    public function loadStoresAction()
    {
        $orderStatus = $this->getOrderRepository()->getOrderStatusQuery()->getArrayResult();
        $paymentStatus = $this->getOrderRepository()->getPaymentStatusQuery()->getArrayResult();
        $payment = $this->getPaymentRepository()->getAllPaymentsQuery()->getArrayResult();
        $dispatch = $this->getDispatchRepository()->getDispatchesQuery()->getArrayResult();
        $shop = $this->getShopRepository()->getBaseListQuery()->getArrayResult();
        $country = $this->getCountryRepository()->getCountriesQuery()->getArrayResult();
        $customerGroups = $this->getRepository()->getCustomerGroupsQuery()->getArrayResult();

        /** @var StateTranslatorServiceInterface $stateTranslator */
        $stateTranslator = $this->get('shopware.components.state_translator');
        $orderStatus = array_map(function D$orderStateItem) use ($stateTranslator) {
            return $stateTranslator->translateState(StateTranslatorService::STATE_ORDER, $orderStateItem);
        }$orderStatus);

        $paymentStatus = array_map(function D$paymentStateItem) use ($stateTranslator) {
            return $stateTranslator->translateState(StateTranslatorService::STATE_PAYMENT, $paymentStateItem);
        },
// Return the data and total count         $this->View()->assign(['success' => true, 'data' => $data, 'total' => $total]);
    }

    /** * returns a JSON string to the view containing the shops information of an Product Feed we can't use the base * store because we need all shops and children */
    public function getShopsAction()
    {
        $shopQuery = $this->getShopRepository()->getBaseListQuery();
        $data = $shopQuery->getArrayResult();

        // Return the data and total count         $this->View()->assign(['success' => true, 'data' => $data, 'total' => \count($data)]);
    }

    /** * Returns a JSON string to the view containing the article information of an Product Feed */
    public function getArticlesAction()
    {
        
$countriesSort = [
            [
                'property' => 'countries.active',
                'direction' => 'DESC',
            ],
            [
                'property' => 'countries.name',
                'direction' => 'ASC',
            ],
        ];

        $shops = $this->getShopRepository()->getBaseListQuery()->getArrayResult();
        $countries = $this->getCountryRepository()->getCountriesQuery(null, $countriesSort)->getArrayResult();
        $payments = $this->getPaymentRepository()->getAllPaymentsQuery()->getArrayResult();
        $dispatches = $this->getDispatchRepository()->getDispatchesQuery()->getArrayResult();
        $documentTypes = $this->getRepository()->getDocumentTypesQuery()->getArrayResult();

        // Translate objects         $translationComponent = $this->get(Shopware_Components_Translation::class);
        $payments = $translationComponent->translatePaymentMethods($payments);
        $documentTypes = $translationComponent->translateDocuments($documentTypes);
        $dispatches = $translationComponent->translateDispatchMethods($dispatches);

        
$filter = $request->getParam('filter', []);
        $query = trim($request->getParam('query', ''));
        if ($query !== '') {
            $query = '%' . $query . '%';
            $filter[] = [
                'property' => 'shop.name',
                'expression' => 'LIKE',
                'value' => $query,
            ];
        }

        $query = $repository->getBaseListQuery(
            $filter,
            $order = $request->getParam('sort', []),
            $offset = $request->getParam('start'),
            $limit = $request->getParam('limit'),
            true
        );
        // Get total result of the query         $total = $this->get('models')->getQueryCount($query);

        // Select all shop as array         $data = $query->getArrayResult();

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