Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8532483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:43:33+00:00 2026-06-11T09:43:33+00:00

I am using FOSUserBundle to manage my users, and I am trying to override

  • 0

I am using FOSUserBundle to manage my users, and I am trying to override the profile edit form, following this doc guide https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Resources/doc/overriding_forms.md
This is my Form type:

<?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'));
    }
}

This is my services.yml add:

 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 }

This is the config.yml part for setting up FOSUSerBundle

profile:
    form:
        type: tracker_user_profile

And finally my Controller Action, which i almost copied 1to1 from original FOSUser Controller:

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

When i call the page, i get the error:

Fatal error: Call to undefined method Tracker\UserBundle\Form\Type\ProfileFormType::createView() in /coding/src/Tracker/UserBundle/Controller/ProfileController.php on line 105

Is there anything wrong with the way i set up the service? or my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:43:34+00:00Added an answer on June 11, 2026 at 9:43 am

    In your controller, retrieve the Form instance instead of the FormType instance:

    $form = $this->container->get('fos_user.profile.form');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Symfony2 and FOSUserBundle. This question is extensible to any other bundled form
I'm using the FOSFacebookBundle and the FOSUserBundle with Symfony2 to manage my users. I
I installed FOSUserBundle and FOSFacebookBundle using this method : How to make a separate
I am building a web application with Symfony 2, using the FOSUserBundle bundle. Users
I am using FOSUserBundle and I am trying to create a page that allows
I am using FOSUserBundle and FOSUserFacebookBundle to authenticate my users. The issue is that
I'm using FOSUserBundle to authenticate users from database and now I want add authentication
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using CI for the first time and i'm smashing my head with this seemingly
Using linq2sql I'm trying to take the string in txtOilChange and update the oilChange

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.