silverstripe / silverstripe/developer-docs

Document how to update ClassName references if changing the name of a DataObject class

Open
#299 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/docs
Dominant language
No language data
Stars
7
Forks
74
Avg merge
1d 14m
Merged PRs (30d)
6

Description

Affected Version

All versions

Description

When a DataObject ClassName is changed the SS project may not work anymore as there may be unexpected references to the classname in the database tables.

Unexpected as: not the main ClassName field in the table relating to the class itself, but references in other tables (including Foo_Versions).

Proposed solution

Use the concepts from this module: https://github.com/sunnysideup/silverstripe-search-all-tables-and-fields and keep a log of changes made.

Question

This may already be covered by:

---
Name: project
---
SilverStripe\ORM\DatabaseAdmin:
  classname_value_remapping:
    Building: 'Project\Web\Models\Building'
    City: 'Project\Web\Models\City'

Although I am not sure if it would fix all mentions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the linked silverstripe-search-all-tables-and-fields module and the DatabaseAdmin classname_value_remapping configuration shown in the issue. Document the verified procedure for changing a DataObject ClassName, including which database references are covered and how to keep a log of changes.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.