Skip to content

Conversation

@dmitryuk
Copy link
Contributor

I need to filter association entities based on current edit entity like this

        yield AssociationField::new('pid')
            ->setQueryBuilder(function (QueryBuilder $queryBuilder, ?EntityDto $dto) use ($entity, $pageName) {
                if (Crud::PAGE_EDIT === $pageName && $dto) {
                    $queryBuilder
                        ->where('entity.siteProduct = :id')
                        ->andWhere('entity.isDeleted = false')
                        ->setParameter('id', $dto->getPrimaryKeyValueAsString())
                    ;
                }

                return $queryBuilder;
            })

@dmitryuk dmitryuk force-pushed the sss branch 3 times, most recently from fc5bc7a to b259dcb Compare December 12, 2025 06:07
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

Successfully merging this pull request may close these issues.

1 participant