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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:01:19+00:00 2026-06-15T20:01:19+00:00

I have an app where each User has a Home. I have overridden my

  • 0

I have an app where each User has a “Home”.

I have overridden my FOSUserBundle registration FormType to embed the Home and capture some properties in the registration process. Unfortunately when I register, the new User is persisted but the new Home is not.

I don’t really want a postPersist listener set on the User in-case I want to create a second User for an existing Home. I assume I have to override the RegistrationFormHandler onSuccess() or process() methods and manually persist the home? If this is the case, do I have to inject the DocumentManager in the constructor? Is this the best way to do it?

I’m using Doctrine MongoDB ODM as the storage layer if that makes any difference?

  • 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-15T20:01:20+00:00Added an answer on June 15, 2026 at 8:01 pm

    I created my own RegistrationFormHandler and overrode the onSuccess method:

    public function onSuccess(UserInterface $user, $confirmation)
    {
        $home = $user->getHome();
        $this->documentManager->persist($home);
        $this->documentManager->flush();
    
        parent::onSuccess($user, $confirmation);
    }
    

    This uses the document manager which you’ll need to inject in the constructor.

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

Sidebar

Related Questions

I have an app with user and events. Each user has several events. When
I currently have a rails app and each user has a profile that has
I have a web app that will draw a polyline for each user (tracks
Have an app that has listings - think classified ads - and each listing
I am writing an app where each User has many posts. I would like
So I have a model called Image that belongs_to :user. Each user has a
I have a table of users and each user has another user that they
I have a TabActivity where each tab has ActivityGroup. On the home ActivityChild of
I have an asp.net mvc app which has membership implemented. So a user has
I'm writing a web app that supports multiple users. Each user has their own

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.