Skip to content

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

@sunnysideup

Description

@sunnysideup

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions