Php Symfony 2.1表单:调用未定义的方法createView()

Php Symfony 2.1表单:调用未定义的方法createView(),php,symfony,symfony-2.1,fosuserbundle,Php,Symfony,Symfony 2.1,Fosuserbundle,我正在使用FOSUserBundle来管理我的用户,并且我正试图按照本文档指南覆盖配置文件编辑表单 这是我的表单类型: <?php namespace Tracker\UserBundle\Form\Type; use Symfony\Component\Form\FormBuilderInterface; use FOS\UserBundle\Form\Type\ProfileFormType as BaseType; class ProfileFormType extends

我正在使用FOSUserBundle来管理我的用户,并且我正试图按照本文档指南覆盖配置文件编辑表单 这是我的表单类型:

<?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'));
    }
}
这是用于设置FOSUSerBundle的
config.yml
部分

profile:
    form:
        type: tracker_user_profile
最后是我的控制器动作,我几乎从原来的FOSUser控制器复制了1到1:

/**
 * 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()


我设置服务的方式有什么问题吗?或者我的代码?

在控制器中,检索表单实例而不是表单类型实例:

$form = $this->container->get('fos_user.profile.form');

是的,我输入了whee项目的main services.yml文件。
$form = $this->container->get('fos_user.profile.form');