EventListener/LeadSubscriber.php
public function correctExtendedFieldColumns(LeadListQueryBuilderGeneratedEvent $event)
    {
        $q            = $event->getQueryBuilder();
        $parts        = $q->getQueryParts();
        $changedParts = [];
        $aliases      = [];
        if (isset($parts['join']['l']) && !empty($this->aliases)) {
            // Confirm the aliases are for the current query by present joins.
            foreach ($parts['join']['l'] as $key => $join) {
                if (
                    is_array($join)
                    && isset($join['joinType'])
                    && 'left' === $join['joinType']
                    && isset($this->aliases[$join['joinAlias']])
                ) {
                    $aliases[$join['joinAlias']] = $this->aliases[$join['joinAlias']];
                }
            }
            if (count($aliases)) {
                foreach ($aliases as $joinAlias => $fieldAlias) {
                    foreach (['where', 'orWhere', 'andWhere', 'having', 'orHaving', 'andHaving'] as $type) {
                        if (isset($parts[$type])) {
                            $changedParts[$type] = $this->partCorrect($parts[$type], $fieldAlias, $this->seen[$fieldAlias]);
                        }
                    }
                }
            }
            foreach ($changedParts as $type => $t) {
                $q->setQueryPart($type, $parts[$type]);
            }
        }
    }
public function correctExtendedFieldColumns(LeadListQueryBuilderGeneratedEvent $event)
    {
        $q            = $event->getQueryBuilder();
        $parts        = $q->getQueryParts();
        $changedParts = [];
        $aliases      = [];
        if (isset($parts['join']['l']) && !empty($this->aliases)) {
            // Confirm the aliases are for the current query by present joins.
            foreach ($parts['join']['l'] as $key => $join) {
                if (
                    is_array($join)
                    && isset($join['joinType'])
                    && 'left' === $join['joinType']
                    && isset($this->aliases[$join['joinAlias']])
                ) {
                    $aliases[$join['joinAlias']] = $this->aliases[$join['joinAlias']];
                }
            }
            if (count($aliases)) {
                foreach ($aliases as $joinAlias => $fieldAlias) {
                    foreach (['where', 'orWhere', 'andWhere', 'having', 'orHaving', 'andHaving'] as $type) {
                        if (isset($parts[$type])) {
                            $changedParts[$type] = $this->partCorrect($parts[$type], $fieldAlias, $this->seen[$fieldAlias]);
                        }
                    }
                }
            }
            foreach ($changedParts as $type => $t) {
                $q->setQueryPart($type, $parts[$type]);
            }
        }
    }
public function correctExtendedFieldColumns ( LeadListQueryBuilderGeneratedEvent $ event ) { $ q = $ event -> getQueryBuilder ( ) ; $ parts = $ q -> getQueryParts ( ) ; $ changedParts = [ ] ; $ aliases = [ ] ; if ( isset ( $ parts [ 'join' ] [ 'l' ] ) && ! empty ( $ this -> aliases ) ) { // Confirm the aliases are for the current query by present joins. foreach ( $ parts [ 'join' ] [ 'l' ] as $ key => $ join ) { if ( is_array ( $ join ) && isset ( $ join [ 'joinType' ] ) && 'left' === $ join [ 'joinType' ] && isset ( $ this -> aliases [ $ join [ 'joinAlias' ] ] ) ) { $ aliases [ $ join [ 'joinAlias' ] ] = $ this -> aliases [ $ join [ 'joinAlias' ] ] ; } } if ( count ( $ aliases ) ) { foreach ( $ aliases as $ joinAlias => $ fieldAlias ) { foreach ( [ 'where' , 'orWhere' , 'andWhere' , 'having' , 'orHaving' , 'andHaving' ] as $ type ) { if ( isset ( $ parts [ $ type ] ) ) { $ changedParts [ $ type ] = $ this -> partCorrect ( $ parts [ $ type ] , $ fieldAlias , $ this -> seen [ $ fieldAlias ] ) ; } } } } foreach ( $ changedParts as $ type => $ t ) { $ q -> setQueryPart ( $ type , $ parts [ $ type ] ) ; } } }
After addExtendedFieldFilters, and the query is fully built, we must correct extended fields to use
the correct table aliases instead of "l.".

@param LeadListQueryBuilderGeneratedEvent $event
After addExtendedFieldFilters and the query is fully built we must correct extended fields to use the correct table aliases instead of l . .