- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
它在 EasyAdminBundle 文档上说
For example, the index() action calls to a method named createIndexQueryBuilder() to create the Doctrine query builder used to get the results displayed on the index listing. If you want to customize that listing, it’s better to override the createIndexQueryBuilder() method instead of the entire index() method.
public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
{
return $this->get(EntityRepository::class)->createQueryBuilder($searchDto, $entityDto, $fields, $filters);
}
我试图像这样覆盖它,但它没有用
public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
{
$response = $this->get(EntityRepository::class)->createQueryBuilder($searchDto, $entityDto, $fields, $filters);
$response->where('isDeleted', true);
return $response;
}
最佳答案
您只需要添加 entity.
在 where 子句中 :)
public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
{
parent::createIndexQueryBuilder($searchDto, $entityDto, $fields, $filters);
$response = $this->get(EntityRepository::class)->createQueryBuilder($searchDto, $entityDto, $fields, $filters);
$response->where('entity.isDeleted = 1');
return $response;
}
关于php - Symfony EasyAdminBundle 3 覆盖 createIndexQueryBuilder(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63432424/
我试图在编辑表单中将标准的“created_at”字段设置为只读。正在关注the doc您必须添加以下配置: MyEntity: form: field
在我用 EasyAdminBundle 创建的管理面板中,我的表单验证仅适用于没有 CKEditorType 的字段。有些字段需要编辑,所以我用 FOSCKEditorBundle 实现了所见即所得。
它在 EasyAdminBundle 文档上说 For example, the index() action calls to a method named createIndexQueryBuil
我有一个带有 assotation 字段类型(相关实体列表)的表单。 我一直试图实现的是在“newAction”表单(创建新实体)上过滤此列表。 例如,以下屏幕: 有一个带有“用户”字段的调查实体。
我已经能够使用 Symfony EasyAdminBundle 为项目构建一个简单的 CRUD 应用程序,它对于基于实体的普通用例非常有效。我有一些额外的用例,但我想做一些事情,比如重建数据。对于这些
我目前正在试验 EasyAdminBundle :我想添加一个调用自定义 Controller 并呈现 View 的菜单项。该 View 不基于实体,而是应该显示 csv 导入的结果。 到目前为止我所
我有一个带有关联字段类型(相关实体列表)的表单。 有带有字段实体“TypeQuizz”(@ORM\ManyToOne)的测验实体。 不可能使用 DQl 过滤器来显示列表测验。 /** * @ORM\
我正在使用带有 FOSUserBundle~2.0 和 EasyAdminBundle^1.17 的 Symfony 3.4。一切正常。我可以登录系统并创建用户((当然有推荐行))我使用这个 tout
我是一名优秀的程序员,十分优秀!