getListGroupsQuery example

/** * Gets a list of the custom newsletter groups (s_campaigns_groups) */
    public function getNewsletterGroupsAction()
    {
        $filter = $this->Request()->getParam('filter');
        $sort = $this->Request()->getParam('sort');
        $limit = $this->Request()->getParam('limit', 10);
        $offset = $this->Request()->getParam('start', 0);

        $groups = $this->getCampaignsRepository()->getListGroupsQuery($filter$sort$limit$offset)->getArrayResult();

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

    /** * Create a new recipient */
    

    public function getOne($id)
    {
        $this->checkPrivilege('read');

        if (empty($id)) {
            throw new ApiException\ParameterMissingException('id');
        }

        $filters = [['property' => 'groups.id', 'expression' => '=', 'value' => $id]];
        $query = $this->getRepository()->getListGroupsQuery($filters);

        /** @var \Shopware\Models\Property\Group|null $property */
        $property = $query->getOneOrNullResult($this->getResultMode());

        if (!$property) {
            throw new ApiException\NotFoundException(sprintf('PropertyGroup by id %d not found', $id));
        }

        return $property;
    }

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