我需要将用户重定向到应用了过滤器“STATUS = ACTIVE”的 CRUD 索引。
我有这个:
$url = $this->adminUrlGenerator
->setController(Customer::class)
->generateUrl();
return $this->redirect($url);
Run Code Online (Sandbox Code Playgroud)
但我找不到向其添加过滤器的方法。我尝试过寻找类似的东西:
->setFilter('Status', 'ACTIVE')
Run Code Online (Sandbox Code Playgroud)
但没有任何运气。文档中没有任何内容。怎么做?
当我使用时:
public function configureFields(string $pageName): iterable
{
return [
AssociationField::new('XYZ')
];
}`
Run Code Online (Sandbox Code Playgroud)
我收到错误"Object of class App\Entity\XYZ could not be converted to string"
当我添加->autocomplete()到 时AssociationField::new('XYZ'),它可以工作,但在保存时显示错误"Expected argument of type "?string", "App\Entity\XYZ" given at property path "XYZ".
使用该字段进行多对一关系的正确方法是什么?Symfony Easy Admin 文档https://symfony.com/doc/current/EasyAdminBundle/fields/AssociationField.html根本没有帮助。