Select an Object From an Entity and Carry That Selection Across the App

I have an app that allows users to fill out a series of forms for a selected construction site they are working on.   Currently, I have one entity (SiteConnection) that is connected to two other entities through a 1-1 association.  This allows me to connect a site in our PM application (PMAppSite) to the correlating site’s data in our task planning application (TaskPlanningAppSite) into a single entity.  I did this so that our users won’t have to select the site they want to fill out the form for both the PMAppSite and TaskPlanningAppSite entities each time they go to another page.   We I want to do is allow our users to select one object from the SiteConnection entity, and have that selection be carried to all forms (pages) in my app.  Any ideas?
1 answers


A couple of thoughts:

  • first – you could associate the SiteConnection entity to the Session entity.  Then when the user selects a SiteConnection object, you can associate that to the current Session (available via $currentSession system variable).  Once this is set, you can access that SiteConnection object throughout your application.
  • second – you may want to re-think your use of one to one associations.  I am not sure of your whole domain model, but if User A sets a one to one association and then, some time later, User B sets a one to one association, both users would see the association set by User B.  This may be the way you want it to work, but it would be an unusual entity structure in my experience.

Hope that helps,