mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #7738 from open-sausages/pulls/4.0/fix-polymorphic-docs-dataobject
DOCS Correct docs on polymorphic dataobject usage
This commit is contained in:
commit
2de2a3e1a9
@ -69,7 +69,7 @@ This is useful where there could be many use cases for a particular data structu
|
|||||||
An additional column is created called "`<relationship-name>`Class", which along
|
An additional column is created called "`<relationship-name>`Class", which along
|
||||||
with the ID column identifies the object.
|
with the ID column identifies the object.
|
||||||
|
|
||||||
To specify that a has_one relation is polymorphic set the type to 'DataObject'.
|
To specify that a has_one relation is polymorphic set the type to [api:SilverStripe\ORM\DataObject]
|
||||||
Ideally, the associated has_many (or belongs_to) should be specified with dot notation.
|
Ideally, the associated has_many (or belongs_to) should be specified with dot notation.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
@ -94,7 +94,7 @@ class Fan extends DataObject
|
|||||||
|
|
||||||
// Generates columns FanOfID and FanOfClass
|
// Generates columns FanOfID and FanOfClass
|
||||||
private static $has_one = [
|
private static $has_one = [
|
||||||
"FanOf" => "DataObject"
|
"FanOf" => DataObject::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user