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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:13:31+00:00 2026-06-16T19:13:31+00:00

I am very new at Symfony2, so please bear with me. I am working

  • 0

I am very new at Symfony2, so please bear with me. I am working on creating a web application where there will be two websites/parent bundles sharing a common bundle. Part of the bundle is my User entity model. With these websites, there are subscriptions to be purchased so the user can access the program part of these websites.

I am thinking that the best is to use the Roles authorization mechanism. I am running into a problem with that. The problem is that I cannot access variables/services (meaning, my website service, which contains information about the current website session) outside of that entity – and that does make sense. Is there a way to take the standard User (class User implements AdvancedUserInterface, \Serializable) entity that I am using for authentication, and turn it into a service? But that seems to present problems because I am using a custom repository for the User class which returns a User class.

So, how can I get external information injected into a User entity model? – I think that is the summary of what I am asking.

Edit:

This is my class definition for the user class:

class User implements AdvancedUserInterface, \Serializable

Here is my security.yml for the website:

providers:
    database:
        entity: { class: WebsiteCommonBundle:User }

I would like to implement the getRoles() function to provide the current roles that the user is a part of. The challenge is that this is dependent on certain criteria to be met (which is different for each website). This information comes from a Symfony service, and it is there, I just don’t know how to get that information pushed into the entity.

  • 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-16T19:13:33+00:00Added an answer on June 16, 2026 at 7:13 pm

    Just having Users isn’t enough for assigning roles/access to the web application. To handle that, you’ll want to implement a UserProvider as well. The docs give a pretty good start on the topic.

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

Sidebar

Related Questions

I'm still very new to Symfony2 so please go easy on me. I'm trying
Very new to python and can't understand why this isn't working. I have a
I've recently upgraded my Symfony2 application to 2.1 and migrated it to a new
Very new to membership provider and just implemented on my new web site. I
very new to signalR, and have rolled up a very simple app that will
Am very New to Web Page Development. In my website i have the help
Am very new to iPhone application development. Am adding the events to iCal from
I am new to Symfony+Doctrine, but fairly experienced with web application development in general
Very new to PHP. I have sucessfully got this piece of code working to
Very new to .Net. Everything was working fine until I added <Tracking> to my

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.