Use DBClassName so that dev/build can migrate legacy classnames - #852
tractorcow wants to merge 1 commit into
Conversation
| { | ||
| private static $db = [ | ||
| 'OwnerClassName' => 'Varchar(255)', | ||
| 'OwnerClassName' => 'DBClassName("SilverStripe\\\\ORM\\\\DataObject")', |
There was a problem hiding this comment.
Should it be DBClassName("SilverStripe\\\\ORM\\\\FieldType\\\\DBVarchar") to keep it effectively a Varchar? Don't understand the change to DataObject.
There was a problem hiding this comment.
That's the base class that DBClassName should use. The Value of 'OwnerClassName' is a subclass of dataobject.
If you don't add a base name it will assume self::class (which is ElementalArea, and thus wrong).
There was a problem hiding this comment.
@michalkleiner I've just skim read this, but the change from varchar to DBClassName is to make it a proper polymorphic relationship, which means that dev/build in framework can perform modifications on it like it does for other polymorphic relations.
There was a problem hiding this comment.
We should build a proper polymorphic belongs_to in core right @robbieaverill ? :P
There was a problem hiding this comment.
Yeah! I guess it this were replaced with Owner -> DataObject then it'd be even more real
I had a few issues where I'd register a class name map with DatabaseAdmin, but elemental wasn't picking this up.
Slashes are double escaped intentionally, in case it looks weird. :P