我正在尝试在表单中添加两个类。所以我为第二堂课做了:
foreach ($formOwnersDetails as $i => $details) {
$form = $form->add("member_{$i}_has_voting_denied", 'checkbox', array(
'data_class' => 'Pro\ConvocationBundle\Entity\OwnerDetails',
'property_path' => "votingDenied",
'label' => ' ',
'required' => false
));
但它给了我一个错误:
Neither property "votingDenied" nor method "getVotingDenied()" nor method "isVotingDenied()" exists in class "Pro\ConvocationBundle\Entity\Convocation"
为什么在字段定义中添加Pro\ConvocationBundle\Entity\Convocation
时会找到data_class
?
答案 0 :(得分:0)
我没有检查它但它应该工作: 有关详细信息,请查看文档entity
$form = $form->add("member_{$i}_has_voting_denied", 'entity', array(
'class' => 'Pro\ConvocationBundle\Entity\OwnerDetails',
'property' => "votingDenied",
'label' => ' ',
'required' => false
));