mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Update changelogs to include notes about database_fields
This commit is contained in:
parent
921bf7df1e
commit
46ce733b9a
@ -1178,20 +1178,20 @@ class MyAddressField extends
|
||||
}
|
||||
```
|
||||
|
||||
### `DataObject::database_fields` or `DataObject::db` {#dataobject-db-database-fields}
|
||||
### Removed `DataObject::database_fields` or `DataObject::db` {#dataobject-db-database-fields}
|
||||
|
||||
These methods have been updated to include base fields (such as ID, ClassName, Created, and LastEdited), as
|
||||
well as composite DB fields.
|
||||
The methods `DataObject::database_fields()`, `DataObject::custom_database_fields()` and `DataObject::db()` have
|
||||
been removed.
|
||||
|
||||
Instead, to get all database fields for a dataobject, including base fields (such as ID, ClassName, Created, and LastEdited), use `DataObject::getSchema()->databaseFields($className, $aggregate = true)`.
|
||||
To omit the base fields, pass a value of `false` as the `$aggregate` parameter, e.g. `DataObject::getSchema()->databaseFields(Member::class, false)`.
|
||||
|
||||
`DataObject::database_fields` does not have a second parameter anymore, and can be called directly on an object
|
||||
or class. E.g. `Member::database_fields()`.
|
||||
If user code requires the list of fields excluding base fields, then use custom_database_fields instead, or
|
||||
make sure to call `unset($fields['ID']);` if this field should be excluded.
|
||||
|
||||
`DataObject:db()` will return all logical fields, including foreign key ids and composite DB Fields, alongside
|
||||
any child fields of these composites. This method can now take a second parameter $includesTable, which
|
||||
when set to true (with a field name as the first parameter), will also include the table prefix in
|
||||
`Table.ClassName(args)` format.
|
||||
Composite database fields are omitted from the `databaseFields()` method. To get those, use `DataObject::getSchema()->compositeFields($className, $aggregate = true)`.
|
||||
|
||||
|
||||
### Rewrite SQLQuery to more specific classes {#sqlquery}
|
||||
|
Loading…
Reference in New Issue
Block a user