silverstripe/silverstripe-framework — pull request #2916 by tractorcow (2014-03-03 23:55:13+00:00)
Title: BUG Prevent unnecessary reconstruction of ClassName field

`DataObject::database_fields` ensures that any ClassName of existing, obsolete classes are maintained when determining the classes for the 'ClassName' Enum field.

The problem is that the ClassName values retrieved from the database are unnecessarily triggering a re-order of the ClassName field on every dev/build. This results in the occasional ClassName regeneration, with no changes other than the order of the enum values. This is most apparent in a new website, where the database is generated, and default records are created. Those default records then necessitate the rebuild of that field, depending on the order they were created. Anyone who's started a new blank project and run two concurrent dev/builds will know what I'm talking about.

This fix ensures that for all known classes, these values will always be present at the beginning of the spec, and the order is determined by the code, rather than the much more volatile values stored in the database.