0
我是Symfony的新手,我嘗試創建一個具有選擇用戶角色能力的註冊表單。Symfony 3註冊角色爲CollectionType(FOSUserBundle)
我用的官方文檔來進行設置:http://symfony.com/doc/current/bundles/FOSUserBundle/overriding_forms.html
但我得到了以下錯誤:
我RegistrationType是:
<?php
namespace DevLeaguesBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
class RegistrationType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
\t \t $builder->add('roles', CollectionType::class, array(
'type' => 'choice',
'options' => array(
'choices' => array(
'ROLE_ADMIN' => 'Admin',
)
)
\t \t \t ));
}
public function getParent()
{
return 'FOS\UserBundle\Form\Type\RegistrationFormType';
}
public function getBlockPrefix()
{
return 'devleagues_user_registration';
}
\t public function getName()
\t {
\t \t return $this->getBlockPrefix();
\t }
}
我想這早些時候,但似乎我必須有什麼不對的地方,因爲現在我得到一個新的錯誤:注意:數組字符串轉換 THX無論如何 –
你絕對確保本通知來源於此線? –
現在,這個代碼被評論,沒有錯誤出現在任何地方。你認爲它可能來自什麼? –