Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retrieve entities as they were at a specific revision #63

Closed
astletron opened this issue May 14, 2014 · 5 comments
Closed

retrieve entities as they were at a specific revision #63

astletron opened this issue May 14, 2014 · 5 comments

Comments

@astletron
Copy link

I would like to be able to 'snapshot' data by getting all entities as they were at a specific revision number.

One way to achieve this might be to modify AuditReader::find such that a NULL $id parameter results in returning an array of 'latest' (greatest revision number equal to or less then the target revision number and not deleted) entities.

https://github.com/simplethings/EntityAudit/blob/master/src/SimpleThings/EntityAudit/AuditReader.php#L55

Happy to fork and submit a pull request if this approach sounds do-able and the feature is desirable.

@andrewtch
Copy link
Contributor

@astletron , this is implemented by loading 1:M relations. Loading full database without filtering can result in HUGE results sets and not much desirable.

Please close this if relations fixes your issue.

@astletron
Copy link
Author

Hiya. Thanks for getting back to me.

Not sure I follow, though. Let me give you an example. I am working on a CMS with a 'publish' workflow. The user modifies content and then pushes a publish button to make the current state live. I would like them to be able to publish historical versions. To do this, I would need to be able to find the state of the database at a particular revision number. Given the current EA interface, I don't think this is possible. Am I missing something?

@andrewtch
Copy link
Contributor

We're actually doing the same thing, that's why I'm making PR's. You can save latest published revision somehow and then load some root entity, all relations will be loaded accordingly. Retrieving full database snapshot is not an option since it can be quite huge and inconsistent.

Given the current EA interface you'll be able to load a particular entity and load all related entites as they were at the point of revision snapshot.

@astletron
Copy link
Author

A single entity that existed at some specific revision is not necessarily connected to all other objects that also existed at that time. What I'm after is way to iterate over all objects of all types as they were at a specific revision number.

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants