getSortConditions example

Shopware()->Container()->get(Connection::class)->executeUpdate(
            'INSERT IGNORE INTO s_product_streams_selection (stream_id, article_id) SELECT :targetStreamId, article_id FROM s_product_streams_selection WHERE stream_id = :sourceStreamId',
            [':targetStreamId' => $targetStreamId, ':sourceStreamId' => $sourceStreamId]
        );

        $this->View()->assign('success', true);
    }

    protected function getSortConditions($sort$model$alias$whiteList = [])
    {
        $sort = parent::getSortConditions($sort$model$alias$whiteList);

        if ($this->isSortingSetByUser($sort)) {
            return $sort;
        }

        return $this->addSortingById($sort);
    }

    /** * @throws ModelNotFoundException if the specified shop couldn't be found */
    
$association = $this->getOwningSideAssociation(
            $this->model,
            $associationKey
        );

        $builder = $this->getReloadAssociationQuery(
            $association['sourceEntity'],
            $association['inversedBy'],
            $association['fieldName']
        );

        $sort = $this->getSortConditions(
            $sort,
            $association['sourceEntity'],
            $association['inversedBy']
        );

        $filter = $this->getFilterConditions(
            $filter,
            $association['sourceEntity'],
            $association['inversedBy']
        );

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