public function getRecordsFromGroups()
    {
        $groupRecords = [];

        $pageIds = GeneralUtility::intExplode(',', $this->conf['pidList'], true);
        $groups = GeneralUtility::intExplode(',', $this->conf['groupSelection'], true);
        if (!empty($groups) && !empty($this->conf['pidList'])) {
            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_address');
            $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));

            if ($this->conf['combination'] === 'AND') {
                $queryBuilder
                    ->select('tt_address.*')
                    ->addSelectLiteral($queryBuilder->expr()->count('tt_address.uid', 'c'))
                    ->from('tt_address')
                    ->join(
                        'tt_address',
                        'sys_category_record_mm',
                        'sys_category_record_mm',
                        $queryBuilder->expr()->eq(
                            'tt_address.uid',
                            $queryBuilder->quoteIdentifier('sys_category_record_mm.uid_foreign')
                        )
                    )
                    ->join(
                        'sys_category_record_mm',
                        'sys_category',
                        'sys_category',
                        $queryBuilder->expr()->eq(
                            'sys_category.uid',
                            $queryBuilder->quoteIdentifier('sys_category_record_mm.uid_local')
                        )
                    )
                    ->where(
                        $queryBuilder->expr()->in('sys_category_record_mm.uid_local', $groups),
                        $queryBuilder->expr()->in('tt_address.pid', $pageIds),
                        $queryBuilder->expr()->eq('sys_category_record_mm.fieldname', $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR)),
                        $queryBuilder->expr()->eq('sys_category_record_mm.tablenames', $queryBuilder->createNamedParameter('tt_address', \PDO::PARAM_STR))
                    )
                    ->groupBy('tt_address.uid')
                    ->having(
                        $queryBuilder->expr()->eq('c', count($groups))
                    );
            } elseif ($this->conf['combination'] === 'OR') {
                $queryBuilder
                    ->select('tt_address.*')
                    ->from('tt_address')
                    ->join(
                        'tt_address',
                        'sys_category_record_mm',
                        'sys_category_record_mm'
                    )
                    ->join(
                        'sys_category_record_mm',
                        'sys_category',
                        'sys_category'
                    )
                    ->where(
                        $queryBuilder->expr()->in('sys_category_record_mm.uid_local', $groups),
                        $queryBuilder->expr()->in('tt_address.pid', $pageIds),
                        $queryBuilder->expr()->eq('sys_category_record_mm.fieldname', $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR)),
                        $queryBuilder->expr()->eq('sys_category_record_mm.tablenames', $queryBuilder->createNamedParameter('tt_address', \PDO::PARAM_STR))
                    )
                    ->groupBy('tt_address.uid');
            }

            $result = $queryBuilder->execute();
            while ($address = $result->fetch()) {
                $groupRecords[$address['uid']] = $this->getGroupsForAddress($address);
            }
        }

        return $groupRecords;
    }
public function getRecordsFromGroups()
    {
        $groupRecords = [];

        $pageIds = GeneralUtility::intExplode(',', $this->conf['pidList'], true);
        $groups = GeneralUtility::intExplode(',', $this->conf['groupSelection'], true);
        if (!empty($groups) && !empty($this->conf['pidList'])) {
            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('tt_address');
            $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));

            if ($this->conf['combination'] === 'AND') {
                $queryBuilder
                    ->select('tt_address.*')
                    ->addSelectLiteral($queryBuilder->expr()->count('tt_address.uid', 'c'))
                    ->from('tt_address')
                    ->join(
                        'tt_address',
                        'sys_category_record_mm',
                        'sys_category_record_mm',
                        $queryBuilder->expr()->eq(
                            'tt_address.uid',
                            $queryBuilder->quoteIdentifier('sys_category_record_mm.uid_foreign')
                        )
                    )
                    ->join(
                        'sys_category_record_mm',
                        'sys_category',
                        'sys_category',
                        $queryBuilder->expr()->eq(
                            'sys_category.uid',
                            $queryBuilder->quoteIdentifier('sys_category_record_mm.uid_local')
                        )
                    )
                    ->where(
                        $queryBuilder->expr()->in('sys_category_record_mm.uid_local', $groups),
                        $queryBuilder->expr()->in('tt_address.pid', $pageIds),
                        $queryBuilder->expr()->eq('sys_category_record_mm.fieldname', $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR)),
                        $queryBuilder->expr()->eq('sys_category_record_mm.tablenames', $queryBuilder->createNamedParameter('tt_address', \PDO::PARAM_STR))
                    )
                    ->groupBy('tt_address.uid')
                    ->having(
                        $queryBuilder->expr()->eq('c', count($groups))
                    );
            } elseif ($this->conf['combination'] === 'OR') {
                $queryBuilder
                    ->select('tt_address.*')
                    ->from('tt_address')
                    ->join(
                        'tt_address',
                        'sys_category_record_mm',
                        'sys_category_record_mm'
                    )
                    ->join(
                        'sys_category_record_mm',
                        'sys_category',
                        'sys_category'
                    )
                    ->where(
                        $queryBuilder->expr()->in('sys_category_record_mm.uid_local', $groups),
                        $queryBuilder->expr()->in('tt_address.pid', $pageIds),
                        $queryBuilder->expr()->eq('sys_category_record_mm.fieldname', $queryBuilder->createNamedParameter('categories', \PDO::PARAM_STR)),
                        $queryBuilder->expr()->eq('sys_category_record_mm.tablenames', $queryBuilder->createNamedParameter('tt_address', \PDO::PARAM_STR))
                    )
                    ->groupBy('tt_address.uid');
            }

            $result = $queryBuilder->execute();
            while ($address = $result->fetch()) {
                $groupRecords[$address['uid']] = $this->getGroupsForAddress($address);
            }
        }

        return $groupRecords;
    }
public function getRecordsFromGroups ( ) { $ groupRecords = [ ] ; $ pageIds = GeneralUtility :: intExplode ( ',' , $ this -> conf [ 'pidList' ] , true ) ; $ groups = GeneralUtility :: intExplode ( ',' , $ this -> conf [ 'groupSelection' ] , true ) ; if ( ! empty ( $ groups ) && ! empty ( $ this -> conf [ 'pidList' ] ) ) { $ queryBuilder = GeneralUtility :: makeInstance ( ConnectionPool :: class ) -> getQueryBuilderForTable ( 'tt_address' ) ; $ queryBuilder -> setRestrictions ( GeneralUtility :: makeInstance ( FrontendRestrictionContainer :: class ) ) ; if ( $ this -> conf [ 'combination' ] === 'AND' ) { $ queryBuilder -> select ( 'tt_address.*' ) -> addSelectLiteral ( $ queryBuilder -> expr ( ) -> count ( 'tt_address.uid' , 'c' ) ) -> from ( 'tt_address' ) -> join ( 'tt_address' , 'sys_category_record_mm' , 'sys_category_record_mm' , $ queryBuilder -> expr ( ) -> eq ( 'tt_address.uid' , $ queryBuilder -> quoteIdentifier ( 'sys_category_record_mm.uid_foreign' ) ) ) -> join ( 'sys_category_record_mm' , 'sys_category' , 'sys_category' , $ queryBuilder -> expr ( ) -> eq ( 'sys_category.uid' , $ queryBuilder -> quoteIdentifier ( 'sys_category_record_mm.uid_local' ) ) ) -> where ( $ queryBuilder -> expr ( ) -> in ( 'sys_category_record_mm.uid_local' , $ groups ) , $ queryBuilder -> expr ( ) -> in ( 'tt_address.pid' , $ pageIds ) , $ queryBuilder -> expr ( ) -> eq ( 'sys_category_record_mm.fieldname' , $ queryBuilder -> createNamedParameter ( 'categories' , \ PDO :: PARAM_STR ) ) , $ queryBuilder -> expr ( ) -> eq ( 'sys_category_record_mm.tablenames' , $ queryBuilder -> createNamedParameter ( 'tt_address' , \ PDO :: PARAM_STR ) ) ) -> groupBy ( 'tt_address.uid' ) -> having ( $ queryBuilder -> expr ( ) -> eq ( 'c' , count ( $ groups ) ) ) ; } elseif ( $ this -> conf [ 'combination' ] === 'OR' ) { $ queryBuilder -> select ( 'tt_address.*' ) -> from ( 'tt_address' ) -> join ( 'tt_address' , 'sys_category_record_mm' , 'sys_category_record_mm' ) -> join ( 'sys_category_record_mm' , 'sys_category' , 'sys_category' ) -> where ( $ queryBuilder -> expr ( ) -> in ( 'sys_category_record_mm.uid_local' , $ groups ) , $ queryBuilder -> expr ( ) -> in ( 'tt_address.pid' , $ pageIds ) , $ queryBuilder -> expr ( ) -> eq ( 'sys_category_record_mm.fieldname' , $ queryBuilder -> createNamedParameter ( 'categories' , \ PDO :: PARAM_STR ) ) , $ queryBuilder -> expr ( ) -> eq ( 'sys_category_record_mm.tablenames' , $ queryBuilder -> createNamedParameter ( 'tt_address' , \ PDO :: PARAM_STR ) ) ) -> groupBy ( 'tt_address.uid' ) ; } $ result = $ queryBuilder -> execute ( ) ; while ( $ address = $ result -> fetch ( ) ) { $ groupRecords [ $ address [ 'uid' ] ] = $ this -> getGroupsForAddress ( $ address ) ; } } return $ groupRecords ; }
gets the addresses which meet the group selection

@return array Array of addresses with their uids as array keys
gets the addresses which meet the group selection