src/CoreBundle/EventListener/DcGeneral/Table/DcaCombine/GroupOptionListener.php
public function handle(GetOptionsEvent $event)
    {
        if (('tl_metamodel_dca_combine' !== $event->getEnvironment()->getDataDefinition()->getName())
            || ('rows' !== $event->getPropertyName())
            || !in_array($event->getSubPropertyName(), ['be_group', 'fe_group'])) {
            return;
        }

        $isBackend = 'be_group' === $event->getSubPropertyName();

        $groups = $this
            ->connection
            ->createQueryBuilder()
            ->select('id')
            ->addSelect('name')
            ->from($isBackend ? 'tl_user_group' : 'tl_member_group')
            ->execute()
            ->fetchAll(\PDO::FETCH_ASSOC);

        $result     = [];
        $result[-1] = $event->getEnvironment()->getTranslator()->translate(
            $isBackend ? 'sysadmin' : 'anonymous',
            'tl_metamodel_dca_combine'
        );

        foreach ($groups as $group) {
            $result[$group['id']] = $group['name'];
        }

        $event->setOptions($result);
    }
public function handle(GetOptionsEvent $event)
    {
        if (('tl_metamodel_dca_combine' !== $event->getEnvironment()->getDataDefinition()->getName())
            || ('rows' !== $event->getPropertyName())
            || !in_array($event->getSubPropertyName(), ['be_group', 'fe_group'])) {
            return;
        }

        $isBackend = 'be_group' === $event->getSubPropertyName();

        $groups = $this
            ->connection
            ->createQueryBuilder()
            ->select('id')
            ->addSelect('name')
            ->from($isBackend ? 'tl_user_group' : 'tl_member_group')
            ->execute()
            ->fetchAll(\PDO::FETCH_ASSOC);

        $result     = [];
        $result[-1] = $event->getEnvironment()->getTranslator()->translate(
            $isBackend ? 'sysadmin' : 'anonymous',
            'tl_metamodel_dca_combine'
        );

        foreach ($groups as $group) {
            $result[$group['id']] = $group['name'];
        }

        $event->setOptions($result);
    }
Get all options for the user groups.

@param GetOptionsEvent $event The event.

@return void