Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Fetch old versions in relations


Go to End


2 Posts   1375 Views

Avatar
zard

Community Member, 25 Posts

7 November 2013 at 11:40pm

Hi!

I am creating a database of booking, where I need the ability to link older versions of objects (hotels and their data) to history of bookings - at this moment, I am successfully capturing whole history using:

Object::add_extension('PhysicalLocation', 'Versioned("Live")');

This works well - however, is there a way to "force" also all relations (which are all Versioned too) to return with a version corresponding to that object? My idea of the "restriction" is that the relevant record should be the latest found in version history which still has modified date older than (or equal to) the parent fetching it - this would ensure that I would always get a snapshot for that time instead of latest (and no longer relevant) data.

Avatar
zard

Community Member, 25 Posts

12 November 2013 at 12:14am

Nobody finds this useful?