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 8099785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:31:30+00:00 2026-06-05T22:31:30+00:00

I am trying to add a custom field to the user form in the

  • 0

I am trying to add a custom field to the user form in the sfGuard plugin.

I have created the column in the database and added the widgetschema for the field. It is showing up correctly in the form, and when text is added and submitted, it is showing the update was successful. The data inserted into the field is not getting populated in the database though.

I am thinking I have to update the model for sfGuard, as it is not aware of the new field. I have tried $ ./symfony doctrine:build-model, but that does not seem to update classes in the sfGuard plugin.

I have added this to sfGuardUserAdminClass :

$this->widgetSchema['department_title'] = new sfWidgetFormInputText();
$this->validatorSchema['department_title'] = new sfValidatorString(array());

I can see the form field and submit, it is just not catching and inserting the data into the db.

UPDATE

I have updated my schema with the MyUser object, migrated the diff and built the model. I added $this->embedRelation('Profile'); in the sfGuardUserAdminForm.class. I am getting this error

"Catchable fatal error: Argument 1 passed to sfUser::__construct() must be an instance of sfEventDispatcher, instance of MyUserTable given, called in /Users/careyestes/Sites/sva/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Table.php on line 301 and defined in /Users/careyestes/Sites/sva/lib/vendor/symfony/lib/user/sfUser.class.php on line 46 Fatal error: Call to a member function evictAll() on a non-object in /Users/careyestes/Sites/sva/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Connection.php on line 1239"
  • 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-05T22:31:33+00:00Added an answer on June 5, 2026 at 10:31 pm

    If you really want to add a field to the user model you have to modify the schema.yml config in plugins/sfDoctrineGuardPlugin/config/doctrine/schema.yml. Find the table sfGuardUser and add your column. But this is not the good way to go as if you update the plugin, you will lost your changes.

    Best is to create a dedicated table which will be linked to the sfGuardUser model with a one-to-one relation. In your config/doctrine/schema.yml create table MyUserProfile:

    MyUserProfile:
      columns:
        id: { type: integer, primary: true, autoincrement: true }
        sf_guard_user_id: { type:integer }
        department_title: { type: string(255) }
        # ... other column definitions
      relations:
        User:
         class: sfGuardUser
         foreignType: one
         foreignAlias: Profile
         local: sf_guard_user_id
         onDelete: CASCADE
    

    After rebuilding all, the custom properties will be accessible via:

    $context->getUser()->getProfile()->getDepartementTitle();
    

    And you can embed the generated MyUserProfileForm form into your sfGuardUserAdminForm form:

    $this->embedRelation('Profile');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to handle add a custom field to a user profile using
Hi I am trying to add a custom field to the Schema.xml of Document
I am trying to add a custom property to a base form that can
I want to add a Custom field to the ContactsContract content provider. I'm trying
I have a CKEditor custom plugin I'm trying to write, but need some help
I am trying to add a custom field to my Django project that uses
I have created my custom field type for listing available users in to Dropdownlist.
I am trying to add an additional custom field to a django model. I
Currently I have a custom user control and within it is a little form
I am trying to add the custom field market into the a href as

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.