Here's a working solution:
public function hookActionOrderGridQueryBuilderModifier(array $params) { $searchQueryBuilder = $params['search_query_builder']; $searchCriteria = $params['search_criteria']; $searchQueryBuilder->addSelect( 'cu.`agecheck` AS `agecheck`' ); if ('agecheck' === $searchCriteria->getOrderBy()) { $searchQueryBuilder->orderBy('cu.`agecheck`', $searchCriteria->getOrderWay()); } foreach ($searchCriteria->getFilters() as $filterName => $filterValue) { if ('agecheck' === $searchCriteria->getOrderBy()) { $searchQueryBuilder->orderBy('cu.`agecheck`', $searchCriteria->getOrderWay()); } if ($filterName === 'agecheck') { $searchQueryBuilder->andWhere("cu.`agecheck` = :agecheck"); $searchQueryBuilder->setParameter('agecheck', $filterValue); } } } public function hookActionOrderGridDefinitionModifier(array $params) { $definition = $params['definition']; $definition->getColumns() ->addAfter('reference', (new StatusColumn('agecheck'))->setName($this->l('18 ?')) ->setOptions( ['field' => 'agecheck',] ) ); $definition->getFilters()->add((new Filter('agecheck', YesAndNoChoiceType::class)) ->setAssociatedColumn('agecheck') ->setTypeOptions([ 'required' => false, ]) ); }