Symfony - 将 Sonata Admin 过滤器运算符设置为“等于"作为默认选项 [英] Symfony - Set Sonata Admin filter operator to "is equal to" as default option
本文介绍了Symfony - 将 Sonata Admin 过滤器运算符设置为“等于"作为默认选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在奏鸣曲管理中,我的管理类中有一个工作过滤器:
In sonata admin I have a working filter in my admin class:
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('client.name');
}
过滤器将默认匹配包含"(LIKE 运算符),如下所示:
The filter will default to match "contains" (LIKE operator) like this:
我希望过滤器使用等于"(= 运算符)作为默认选项而不是包含":
I would like the filter to use "is equals to" (= operator) as the default option instead of "contains":
不幸的是,我在 SO、google 和 奏鸣曲文档 9.4过滤器目前没有记录.
Unfortunately I couldn't find questions or answers related to this in SO, google, and the Sonata docs 9.4 filters is currently not documented.
我该怎么做?
推荐答案
您可以通过覆盖变量 $datagridValues
protected $datagridValues = array(
'email' => array(
'type' => 3,
'value' => ''
)
);
'type' =>3
表示它的等于
这篇关于Symfony - 将 Sonata Admin 过滤器运算符设置为“等于"作为默认选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文