Tôi đang cố ghi đè RegistrationFormType trong Symfony2 FOSUserBundle. Tôi đang theo dõi tài liệu và tin rằng tôi đã bảo vệ mọi thứ. Tôi đã tạo một gói chứa các ghi đè của tôi cho FOSUserBundle và mã sau đây là từ gói này cũng như cấu hình ứng dụng.Không thể tải loại lỗi "XYZ" khi ghi đè các loại biểu mẫu FOSUserBundle
Có ai đã trải nghiệm điều này khi ghi đè FOSUserBundle hoặc xem bất kỳ điều gì trong mã của tôi có thể giúp giải thích tại sao tôi tiếp tục gặp lỗi này. Tôi đang trên symfony v2.0.4
RegistrationFormType.php
<?php
/*
* This file is part of the FOSUserBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Thrive\SaasBundle\Form\Type;
use Symfony\Component\Form\FormBuilder;
use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType;
class RegistrationFormType extends BaseType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('firstname', null, array('error_bubbling' => true))
->add('lastname', null, array('error_bubbling' => true))
->add('company', null, array('error_bubbling' => true))
->add('email', 'email', array('error_bubbling' => true))
->add('username', null, array('error_bubbling' => true))
->add('plainPassword', 'repeated', array('type' => 'password', 'error_bubbling' => true))
;
}
public function getName()
{
return 'thrive_user_registration';
}
}
Services.yml
services:
thrive_saas_registration.form.type:
class: Thrive\SaasBundle\Form\Type\RegistrationFormType
arguments: [%fos_user.model.user.class%]
tags:
- { name: form.type, alias: thrive_user_registration}
của ứng dụng Config file
fos_user:
...
registration:
form:
type: thrive_user_registration
Cách sử dụng tham số này '% fos_user.model.user.form_data_class%' thay vì '% fos_user.model.user.class%' trong định nghĩa dịch vụ? –