Question

I'm trying to store revision comments using Enver's RevisionEntity so that it's in the same table as the revision ID and timestamp and is stored only once even if multiple entities are changed.

My current approach is

  • controller action that handles the request puts comments into a session variable
  • my custom RevisionListener reads the session variable, adds the comments to the RevisionEntity, and clears the session variable

I'm not that happy with this approach though. It seems like it will be prone to race conditions and other goofy behavior. Is there any way I can make this more solid? Maybe by accessing the RevisionEntity directly in the controller action?

Était-ce utile?

La solution

I'm not sure if I really understand your problem, but if you only want to store some information during the request-handling, you can use Http.Request.current().args. As the description in the API docs says, it's:

Free space to store your request specific data

Your controller action will just need to copy the comments from params (or wherever else they're coming from) and store them in the args map, and then the RevisionListener can retrieve them from there.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top