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

  • Home
  • SEARCH
  • 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 9196125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:46:56+00:00 2026-06-17T21:46:56+00:00

I thought I followed the documentation very closely, but for some reason, I am

  • 0

I thought I followed the documentation very closely, but for some reason, I am receiving this error message..

Could not load type “sam_user_registration”

// src/Sam/Bundle/UserBundle/Entity/User.php

namespace Sam\Bundle\UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use FOS\UserBundle\Entity\User as BaseUser;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity
 * @ORM\Table(name="sam_user")
 */
class User extends BaseUser
{
/**
 * @var string $id
 *
 * @ORM\Id
 * @ORM\Column(name="id", type="integer")
 * @ORM\GeneratedValue(strategy="AUTO")
 */
protected $id;

/**
 * Get id
 *
 * @return string $id
 */
public function getId()
{
    return $this->id;
}

/**
 * @ORM\Column(type="string", length=255)
 *
 * @Assert\NotBlank(message="Please enter your name.", groups={"Registration", "Profile"})
 * @Assert\MinLength(limit="3", message="The name is too short.", groups={"Registration", "Profile"})
 * @Assert\MaxLength(limit="255", message="The name is too long.", groups={"Registration", "Profile"})
 */
protected $name;

// src/Sam/Bundle/UserBundle/Form/Type/RegistrationFormType.php

<?php

namespace Sam\Bundle\UserBundle\Form\Type;

use Symfony\Component\Form\FormBuilderInterface;
use FOS\UserBundle\Form\Type\RegistrationFormType as BaseType;

class RegistrationFormType extends BaseType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
    parent::buildForm($builder, $options);

    // add your custom field
    $builder->add('name');
}

public function getName()
{
    return 'sam_user_registration';
}
}

** src/Sam/Bundle/UserBundle/Resources/config/services.xml **

<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<service id="sam_user.registration.form.type" class="Sam\Bundle\UserBundle\Form\Type\RegistrationFormType">
        <tag name="form.type" alias="sam_user_registration" />
        <argument>%fos_user.model.user.class%</argument>
    </service>

</container>

# app/config/config.yml

fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
#user_class: Sam\Bundle\UserBundle\Document\User
user_class: Sam\Bundle\UserBundle\Entity\User

group:
    group_class:  Sam\Bundle\UserBundle\Entity\Group

profile:  # Authentication Form
    form:
        type:               fos_user_profile
        name:               fos_user_profile_form
        validation_groups:  [Authentication] 

registration:
        form:
            type:               sam_user_registration
  • 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-17T21:46:58+00:00Added an answer on June 17, 2026 at 9:46 pm

    First your user class is missing its constructor. Since you inherit BaseUser you have to call the parent constructor too. So…

    public function __construct()
    {
        parent::__construct();
    
        //your code
    
    }
    

    Second you do not need to override the form type. Since you have added the name field to your entity it will be available in your form automatically via

    {{ form_widget(myForm.name)} }
    

    -> FosUserBundle Doc

    However, are your sure you imported your services.xml in your config.yml AND why are you mixing xml and yml? Just stick to one.

    imports:
        - { resource: @SamBundleUserBundle/Resources/config/services.yml }
    

    And in an comment Patt pointed our overriding registration FOSUserBundle Symfony2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought this would be fairly simple but it turns out not to work
I thought I had resolved this but I obviously haven't and was hoping someone
I thought I'd find more about this topic but I didn't. I have to
I'm trying to get matches of single bracket followed by a non-space, but not
I thought IE7 and above followed the same box model as Chrome/Firefox/Opera, but when
I followed this thread . I now have: <a href=# onclick=$('#gc').load('test');>reload</a>... </span> <div id=gc>
I thought I had correctly followed the recommendations in this question for checking undefined
I thought this would be really easy but I can't find a simple solution,
Thought my range of search options would easily find this. I wish to combine
I thought the following script will create div element but I got nothing output

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.