Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joins are duplicated in comparison to v4 #280

Open
hrach opened this issue Jan 29, 2025 · 1 comment
Open

Joins are duplicated in comparison to v4 #280

hrach opened this issue Jan 29, 2025 · 1 comment
Labels

Comments

@hrach
Copy link
Member

hrach commented Jan 29, 2025

Because the key was not sufficient to unify the "same" joins.

I knew there must have been a reason behind it.

Anyway upgrade to v5 breaks some our grids under specific conditions (when joining the same table multiple times)

// Ublaboo\DataGrid

// sorting
$this->addColumnText('billingEntity', 'Billing Entity')
    ->setSortableCallback(function (DbalCollection $source, $order) {
        $source->getQueryBuilder()
            ->joinLeft('company co', 'co.id = c.billing_entity_id')
            ->orderBy($order);
    });
// filtering
this->addFilterMultiSelect('billingEntity', 'Billing Entity', $billingEntityCompanies)
    ->setCondition(function (DbalCollection $source, ArrayHash $values) {
        // omitted code...
        $source->getQueryBuilder()
            ->joinLeft('company co', 'co.id = c.billing_entity_id')
            ->andWhere($query, ...$params);
    });

Originally posted by @mskocik in #724

@hrach hrach added the bug label Jan 29, 2025
@mskocik
Copy link

mskocik commented Jan 29, 2025

What about detecting %table or % in general (to support also %column?)

When detected add join with no key (v5 behavior), otherwise add join with key (v4 behavior). I could prepare PR, if this approach seems ok to you.

I have no other alternative at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants