Symfony 3 - Doctrine验证和用户角色

时间:2017-11-03 10:08:13

标签: symfony validation doctrine roles

我的实体中有insert into table2(col_t2) select val from (select 'r1' val from dual union all select 'r2' from dual) where exists (select 'x' from table1 where some_criterium='some_value') 属性,我想根据用户角色定义不同的file约束。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您可以将自定义约束用作服务并向其注入AuthorizationCheckerInterface:

https://symfony.com/doc/current/validation/custom_constraint.html