FOSUserBundle を使用してユーザーを管理しています。このドキュメント ガイドに従って、プロファイル編集フォームを上書きしようとしていますhttps://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_forms.md これは私のフォームタイプ:
<?php
namespace Tracker\UserBundle\Form\Type;
use Symfony\Component\Form\FormBuilderInterface;
use FOS\UserBundle\Form\Type\ProfileFormType as BaseType;
class ProfileFormType extends BaseType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $this->buildUserForm($builder, $options);
    }
    public function getName()
    {
        return 'tracker_user_profile';
    }
    /**
     * Builds the embedded form representing the user.
     *
     * @param FormBuilderInterface $builder
     * @param array                $options
     */
    protected function buildUserForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
            ->add('email', 'email', array('label' => 'form.email', 'translation_domain' => 'FOSUserBundle'))
            ->add('avatar','file',array( 'required'=>'true'));
    }
}
これは私のservices.yml追加です:
 tracker_user.profile.form.type:
         class: Tracker\UserBundle\Form\Type\ProfileFormType
         arguments: [%fos_user.model.user.class%]
         tags:
             - { name: form.type, alias: tracker_user_profile }
config.ymlセッティングするパーツですFOSUSerBundle
profile:
    form:
        type: tracker_user_profile
最後に、元の FOSUser コントローラーから 1to1 をほぼコピーしたコントローラー アクション:
/**
 * Edit the user
 */
public function editAction()
{
    $user = $this->container->get('security.context')->getToken()->getUser();
    if (!is_object($user) || !$user instanceof UserInterface) {
        throw new AccessDeniedException('This user does not have access to this section.');
    }
    $form = $this->container->get('tracker_user.profile.form.type');
    $formHandler = $this->container->get('fos_user.profile.form.handler');
    $process = $formHandler->process($user);
    if ($process) {
        $this->setFlash('fos_user_success', 'profile.flash.updated');
        return new RedirectResponse($this->getRedirectionUrl($user));
    }
    return $this->container->get('templating')->renderResponse(
        'FOSUserBundle:Profile:edit.html.'.$this->container->getParameter('fos_user.template.engine'),
        array('form' => $form->createView())
    );
}
ページを呼び出すと、次のエラーが表示されます。
致命的なエラー: 105 行目の /coding/src/Tracker/UserBundle/Controller/ProfileController.php の未定義メソッド Tracker\UserBundle\Form\Type\ProfileFormType::createView() の呼び出し
サービスの設定方法に問題はありますか? または私のコード?