Aimeos\ShopBundle\Service\Support::getGroups PHP Method

getGroups() public method

Returns the closure for retrieving the user groups
public getGroups ( Aimeos\MShop\Context\Item\Iface $context ) : array
$context Aimeos\MShop\Context\Item\Iface Context object
return array List of group codes the user is in
    public function getGroups(\Aimeos\MShop\Context\Item\Iface $context)
    {
        $list = array();
        $manager = \Aimeos\MShop\Factory::createManager($context, 'customer/group');
        $search = $manager->createSearch();
        $search->setConditions($search->compare('==', 'customer.group.id', $context->getGroupIds()));
        foreach ($manager->searchItems($search) as $item) {
            $list[] = $item->getCode();
        }
        return $list;
    }
Support