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

Add some join for default query for NEW, EDIT, and DETAIL pages #6298

Closed
bloodangel78 opened this issue May 15, 2024 · 2 comments
Closed

Add some join for default query for NEW, EDIT, and DETAIL pages #6298

bloodangel78 opened this issue May 15, 2024 · 2 comments

Comments

@bloodangel78
Copy link

bloodangel78 commented May 15, 2024

Hello,

I am using Easy Admin in version 4.10

On the index page, we have this function to add some join for associated relations of main entity

public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
    {
        $qb = parent::createIndexQueryBuilder($searchDto, $entityDto, $fields, $filters);
        $qb->leftJoin('entity.translations', 'entityTranslations')->addSelect('entityTranslations');
        $qb->leftJoin('entity.blocks', 'blocks')->addSelect('blocks');
        $qb->leftJoin('blocks.columns', 'columns')->addSelect('columns');
        $qb->leftJoin('columns.widgets', 'widgets')->addSelect('widgets');
        $qb->leftJoin('widgets.translations', 'widgetsTranslations')->addSelect('widgetsTranslations');

        return $qb;
    }

But for other pages like: NEW, EDIT, and DETAIL pages, how can we add some join to the main query?

Thanks for help

@dwd-akira
Copy link
Contributor

Hi,

You can override function find($id, $lockMode = null, $lockVersion = null) in YourEntityRepository

@bloodangel78
Copy link
Author

Nice thanks a lot.

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

No branches or pull requests

2 participants