【发布时间】:2015-05-13 08:49:14
【问题描述】:
我有一个取消订阅表单,其中第一个字段是一个实体字段,用于获取我的 UnsubscribeType 实体:
$builder
->add('type', 'entity', array(
'class' => 'Evo\SubscriptionBundle\Entity\UnsubscribeType',
'property' => 'name',
'label' => 'Choose process type',
'empty_value' => 'Choose an option',
'empty_data' => null,
'label_attr' => array(
'class' => 'control-label',
),
'attr' => array(
'class' => 'form-control',
),
))
此集合包含 2 个实体,#1 和 #2。如果有关已验证用户的自定义测试失败,我想从选择字段中删除实体 #2。
假设我要测试$this->getUser()->getCustomField()。如果是false,那么我想从包含我的 UnsubscribeType 实体的选择字段中删除实体 #2。
知道怎么做吗?
【问题讨论】: