Skip to content

Commit

Permalink
REFACTOR migrate to Silverstripe Link (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsirish authored Aug 14, 2024
1 parent 12337a8 commit cb46e52
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
17 changes: 3 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Tools to build common functionality in SilverStripe sites.
## Requirements

* Silverstripe ^5
* gorriecoe/silverstripe-linkfield ^1.0
* silvershop/silverstripe-hasonefield ^4
* silverstripe/linkfield: ^4
* symbiote/silverstripe-gridfieldextensions ^4
* unclecheese/display-logic ^3

Expand All @@ -28,20 +28,9 @@ composer require dynamic/silverstripe-site-tools
## License
See [License](license.md)

## Upgrading from version 1
## Upgrading from version 3

Site Tools drops `sheadawson/silverstripe-linkable` usage in favor of `gorriecoe/silverstripe-linkfield`. To avoid data loss, install the `dynamic/silverstripe-link-migrator` module as follows:

```markdown
composer require dynamic/silverstripe-link-migrator
```

Then, run the task "Linkable to SilverStripe Link Migration" via `/dev/tasks`, or cli via:
```markdown
vendor/bin/sake dev/tasks/LinkableMigrationTask
```

This will populate all of the new Link fields with data from the old class.
This module drops `gorriecoe/silverstripe-linkfield` usage in favor of `silverstripe/linkfield`.

## Maintainers
* [Dynamic](http://www.dynamicagency.com) (<[email protected]>)
Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
}
],
"require": {
"gorriecoe/silverstripe-linkfield": "^1.0",
"silvershop/silverstripe-hasonefield": "^4.0",
"silverstripe/linkfield": "^4.0",
"silverstripe/recipe-cms": "^5",
"symbiote/silverstripe-gridfieldextensions": "^4",
"unclecheese/display-logic": "^3.0"
},
"require-dev": {
"dnadesign/silverstripe-elemental": "^5",
"silverstripe/recipe-testing": "^3.0"
},
"minimum-stability": "dev",
Expand All @@ -35,8 +36,8 @@
"config": {
"allow-plugins": {
"composer/installers": true,
"silverstripe/vendor-plugin": true,
"silverstripe/recipe-plugin": true
"silverstripe/recipe-plugin": true,
"silverstripe/vendor-plugin": true
},
"process-timeout": 600
},
Expand Down
17 changes: 12 additions & 5 deletions src/Model/HeaderImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace Dynamic\SiteTools\Model;

use gorriecoe\Link\Models\Link;
use gorriecoe\LinkField\LinkField;
use SilverStripe\AssetAdmin\Forms\UploadField;
use SilverStripe\Assets\Image;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\FieldList;
use SilverStripe\ORM\DataObject;
use SilverStripe\Forms\FieldList;
use SilverStripe\Security\Security;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\LinkField\Models\Link;
use SilverStripe\LinkField\Form\LinkField;
use SilverStripe\AssetAdmin\Forms\UploadField;

/**
* Class \Dynamic\SiteTools\Model\HeaderImage
Expand All @@ -27,6 +27,7 @@ class HeaderImage extends DataObject
{
/**
* @var array
* @config
*/
private static $db = [
'Title' => 'Varchar(255)',
Expand All @@ -35,6 +36,7 @@ class HeaderImage extends DataObject

/**
* @var array
* @config
*/
private static $has_one = [
'Page' => SiteTree::class,
Expand All @@ -44,27 +46,31 @@ class HeaderImage extends DataObject

/**
* @var string[]
* @config
*/
private static $cascade_duplicates = [
'HeaderLink',
];

/**
* @var array
* @config
*/
private static $owns = [
'Image',
];

/**
* @var array
* @config
*/
private static $searchable_fields = [
'Title',
];

/**
* @var array
* @config
*/
private static $summary_fields = [
'Image.CMSThumbnail' => 'Image',
Expand All @@ -73,6 +79,7 @@ class HeaderImage extends DataObject

/**
* @var string
* @config
*/
private static $table_name = 'HeaderImage';

Expand Down

0 comments on commit cb46e52

Please sign in to comment.