PHPackages                             heyday/silverstripe-versioneddataobjects - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. heyday/silverstripe-versioneddataobjects

ActiveSilverstripe-module[Framework](/categories/framework)

heyday/silverstripe-versioneddataobjects
========================================

Provides Versioned DataObjects in SilverStripe

2.0.5(9y ago)21198.6k↑31.4%20[2 issues](https://github.com/heyday/silverstripe-versioneddataobjects/issues)5PHPCI failing

Since Jul 22Pushed 6y ago27 watchersCompare

[ Source](https://github.com/heyday/silverstripe-versioneddataobjects)[ Packagist](https://packagist.org/packages/heyday/silverstripe-versioneddataobjects)[ RSS](/packages/heyday-silverstripe-versioneddataobjects/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (27)Used By (5)

SilverStripe Versioned DataObjects
==================================

[](#silverstripe-versioned-dataobjects)

This module provides an easy to use implementation of SilverStripe's built-in `Versioned` extension for DataObjects, along with admin components to manage your versioned things.

**IMPORTANT**: Versioning of DataObjects is [built-in](https://docs.silverstripe.org/en/4/developer_guides/model/versioning/) to the `Versioned` extension in SilverStripe 4.x and newer.

[![Versioned DataObject Example](resources/example.png?raw=true)](resources/example.png?raw=true)[![Versioned DataObject Example 2](resources/example2.png?raw=true)](resources/example2.png?raw=true)

Installation (with composer)
----------------------------

[](#installation-with-composer)

```
$ composer require heyday/silverstripe-versioneddataobjects

```

Usage
-----

[](#usage)

The `VersionedDataObject` extension adds the same draft/published versioning used for pages to your own DataObjects, and any subclasses they have. Only fields in the table of a DataObject with this extension will be versioned. Related DataObjects need `VersionedDataObject` applied separately if required.

```
class Slice extends DataObject
{
	private static $db = [
		'Content' => 'Text'
	];

	private static $has_one = [
		'Parent' => 'SiteTree'
	];

	private static $extensions = [
		'Heyday\VersionedDataObjects\VersionedDataObject'
	];
}
```

### Versioned DataObjects in a GridField

[](#versioned-dataobjects-in-a-gridfield)

To use `VersionedDataObject` records in a GridField, `GridFieldDetailForm` needs to be replaced with `VersionedDataObjectDetailsForm`:

```
// ...

public function getCMSFields()
{
	$fields = parent::getCMSFields();

	$fields->addFieldToTab(
		'Root.Slices',
		new GridField(
			'Slices',
			'Slices',
			$this->Slices(),
			$config = GridFieldConfig_RelationEditor::create()
		)
	);

	$config->removeComponentsByType('GridFieldDetailForm');
	$config->addComponent(new Heyday\VersionedDataObjects\VersionedDataObjectDetailsForm());

	return $fields;
}

// ...
```

### Versioned DataObjects in a ModelAdmin

[](#versioned-dataobjects-in-a-modeladmin)

```
class SliceAdmin extends Heyday\VersionedDataObjects\VersionedModelAdmin
{
	private static $menu_title = 'Slices';

	private static $url_segment = 'slice';

	private static $managed_models = [
		'Slice'
	];
}
```

Cavets / Troubleshooting
------------------------

[](#cavets--troubleshooting)

SilverStripe's versioning system uses global state to keep track of a *"reading mode"* that affects which tables records are read from and written to for all uses of the `Versioned` extension. This works on the front end of a site where you expect to see the currently selected stage, however it also alters what records are visible in the CMS if not adjusted for. The admin components supplied with this module work around this to always show draft records in the CMS.

If you have control over an ORM query, you can alter the behaviour of `Versioned` with DataQuery parameters to override the global reading mode setting:

```
VersionedFoo::get()
	->setDataQueryParam(['Versioned.stage' => 'Stage']);
```

If you can't modify a query, you can use [`VersionedReadingMode`](https://github.com/heyday/silverstripe-versioneddataobjects/blob/master/code/VersionedReadingMode.php) from this module to change and restore the global reading mode around a piece of code:

```
VersionedReadingMode::setStageReadingMode();

// ... code that runs queries

VersionedReadingMode::restoreOriginalReadingMode();
```

If you suspect you might be seeing an issue from incorrect reading mode, the global reading mode can be changed between *live* and *stage* by adding the query string `?stage=Stage` or `?stage=Live` to the current URL.

### BetterButtons compatibility

[](#betterbuttons-compatibility)

This module works with `unclecheese/betterbuttons` version `1.2.8`.

Unit testing
------------

[](#unit-testing)

None :(

\##License

SilverStripe Versioned DataObjects is licensed under an [MIT license](http://heyday.mit-license.org/)

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~96 days

Recently: every ~284 days

Total

25

Last Release

2364d ago

Major Versions

1.5.0 → 2.0.02016-06-29

2.0.5 → 3.7.x-dev2019-11-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/de4d8d61f202a03e88c3ed30cce3bfedbc6f56a16e3f3b25546c61aadc51bca2?d=identicon)[heyday](/maintainers/heyday)

---

Top Contributors

[![stecman](https://avatars.githubusercontent.com/u/2230769?v=4)](https://github.com/stecman "stecman (21 commits)")[![glenn-bautista](https://avatars.githubusercontent.com/u/375172?v=4)](https://github.com/glenn-bautista "glenn-bautista (13 commits)")[![camspiers](https://avatars.githubusercontent.com/u/51294?v=4)](https://github.com/camspiers "camspiers (13 commits)")[![kdanilewicz](https://avatars.githubusercontent.com/u/1428945?v=4)](https://github.com/kdanilewicz "kdanilewicz (3 commits)")[![lucasfrey](https://avatars.githubusercontent.com/u/7697132?v=4)](https://github.com/lucasfrey "lucasfrey (3 commits)")[![tylerkidd](https://avatars.githubusercontent.com/u/1338983?v=4)](https://github.com/tylerkidd "tylerkidd (2 commits)")[![alex-dna](https://avatars.githubusercontent.com/u/6982515?v=4)](https://github.com/alex-dna "alex-dna (2 commits)")[![christopherdarling](https://avatars.githubusercontent.com/u/178039?v=4)](https://github.com/christopherdarling "christopherdarling (1 commits)")[![jakeb-blissmedia](https://avatars.githubusercontent.com/u/9790714?v=4)](https://github.com/jakeb-blissmedia "jakeb-blissmedia (1 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (1 commits)")[![azt3k](https://avatars.githubusercontent.com/u/1156443?v=4)](https://github.com/azt3k "azt3k (1 commits)")[![assertchris](https://avatars.githubusercontent.com/u/200609?v=4)](https://github.com/assertchris "assertchris (1 commits)")[![stevie-mayhew](https://avatars.githubusercontent.com/u/1953220?v=4)](https://github.com/stevie-mayhew "stevie-mayhew (1 commits)")[![adrexia](https://avatars.githubusercontent.com/u/984753?v=4)](https://github.com/adrexia "adrexia (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/heyday-silverstripe-versioneddataobjects/health.svg)

```
[![Health](https://phpackages.com/badges/heyday-silverstripe-versioneddataobjects/health.svg)](https://phpackages.com/packages/heyday-silverstripe-versioneddataobjects)
```

###  Alternatives

[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[drupal/recommended-project

Project template for Drupal projects with a relocated document root

1502.6M1](/packages/drupal-recommended-project)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[october/rain

October Rain Library

1601.7M63](/packages/october-rain)[juzaweb/cms

Juzaweb CMS is a Content Management System (CMS) developed based on Laravel Framework and web platform whose sole purpose is to make your development workflow simple again. Project develop by Juzaweb

187571.2k](/packages/juzaweb-cms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
