mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Reverted DBField & list both [Field] and [DBField]
I changed the list of types to the suggested format for clarity and changed Field back to DBField as suggested.
This commit is contained in:
parent
f08915ccf2
commit
c7eede1d66
@ -6,7 +6,7 @@ summary: Learn how how data is stored going in and coming out of the ORM and how
|
|||||||
Each model in a SilverStripe [DataObject](api:SilverStripe\ORM\DataObject) will handle data at some point. This includes database columns such as
|
Each model in a SilverStripe [DataObject](api:SilverStripe\ORM\DataObject) will handle data at some point. This includes database columns such as
|
||||||
the ones defined in a `$db` array or simply a method that returns data for the template.
|
the ones defined in a `$db` array or simply a method that returns data for the template.
|
||||||
|
|
||||||
A Data Type is represented in SilverStripe by a [Field](api:SilverStripe\ORM\FieldType\DBField) subclass. The class is responsible for telling the ORM
|
A Data Type is represented in SilverStripe by a [DBField](api:SilverStripe\ORM\FieldType\DBField) subclass. The class is responsible for telling the ORM
|
||||||
about how to store its data in the database and how to format the information coming out of the database, i.e. on a template.
|
about how to store its data in the database and how to format the information coming out of the database, i.e. on a template.
|
||||||
|
|
||||||
In the `Player` example, we have four database columns each with a different data type (Int, Varchar).
|
In the `Player` example, we have four database columns each with a different data type (Int, Varchar).
|
||||||
@ -29,21 +29,21 @@ class Player extends DataObject
|
|||||||
|
|
||||||
## Available Types
|
## Available Types
|
||||||
|
|
||||||
* [Boolean](api:SilverStripe\ORM\FieldType\DBBoolean): A boolean field.
|
* `'Boolean'`: A boolean field (see: [DBBoolean](api:SilverStripe\ORM\FieldType\DBBoolean)).
|
||||||
* [Currency](api:SilverStripe\ORM\FieldType\DBCurrency): A number with 2 decimal points of precision, designed to store currency values.
|
* `'Currency'`: A number with 2 decimal points of precision, designed to store currency values (see: [DBCurrency](api:SilverStripe\ORM\FieldType\DBCurrency)).
|
||||||
* [Date](api:SilverStripe\ORM\FieldType\DBDate): A date field
|
* `'Date'`: A date field (see: [DBDate](api:SilverStripe\ORM\FieldType\DBDate)).
|
||||||
* [Decimal](api:SilverStripe\ORM\FieldType\DBDecimal): A decimal number.
|
* `'Decimal'`: A decimal number (see: [DBDecimal](api:SilverStripe\ORM\FieldType\DBDecimal)).
|
||||||
* [Enum](api:SilverStripe\ORM\FieldType\DBEnum): An enumeration of a set of strings
|
* `'Enum'`: An enumeration of a set of strings (see: [DBEnum](api:SilverStripe\ORM\FieldType\DBEnum)).
|
||||||
* [HTMLText](api:SilverStripe\ORM\FieldType\DBHTMLText): A variable-length string of up to 2MB, designed to store HTML
|
* `'HTMLText'`: A variable-length string of up to 2MB, designed to store HTML (see: [DBHTMLText](api:SilverStripe\ORM\FieldType\DBHTMLText)).
|
||||||
* [HTMLVarchar](api:SilverStripe\ORM\FieldType\DBHTMLVarchar): A variable-length string of up to 255 characters, designed to store HTML
|
* `'HTMLVarchar'`: A variable-length string of up to 255 characters, designed to store HTML (see: [DBHTMLVarchar](api:SilverStripe\ORM\FieldType\DBHTMLVarchar)).
|
||||||
* [Int](api:SilverStripe\ORM\FieldType\DBInt): An integer field.
|
* `'Int'`: An integer field (see: [DBInt](api:SilverStripe\ORM\FieldType\DBInt)).
|
||||||
* [Percentage](api:SilverStripe\ORM\FieldType\DBPercentage): A decimal number between 0 and 1 that represents a percentage.
|
* `'Percentage'`: A decimal number between 0 and 1 that represents a percentage (see: [DBPercentage](api:SilverStripe\ORM\FieldType\DBPercentage)).
|
||||||
* [Datetime](api:SilverStripe\ORM\FieldType\DBDatetime): A date / time field
|
* `'Datetime'`: A date / time field (see: [DBDatetime](api:SilverStripe\ORM\FieldType\DBDatetime)).
|
||||||
* [Text](api:SilverStripe\ORM\FieldType\DBText): A variable-length string of up to 2MB, designed to store raw text
|
* `'Text'`: A variable-length string of up to 2MB, designed to store raw text (see: [DBText](api:SilverStripe\ORM\FieldType\DBText)).
|
||||||
* [Time](api:SilverStripe\ORM\FieldType\DBTime): A time field
|
* `'Time'`: A time field (see: [DBTime](api:SilverStripe\ORM\FieldType\DBTime)).
|
||||||
* [Varchar](api:SilverStripe\ORM\FieldType\DBVarchar): A variable-length string of up to 255 characters, designed to store raw text.
|
* `'Varchar'`: A variable-length string of up to 255 characters, designed to store raw text (see: [DBVarchar](api:SilverStripe\ORM\FieldType\DBVarchar)).
|
||||||
|
|
||||||
See the [API documentation](api:SilverStripe\ORM\FieldType\DBField) for a full list of available Data Types. You can define your own [Field](api:SilverStripe\ORM\FieldType\DBField) instances if required as well.
|
See the [API documentation](api:SilverStripe\ORM\FieldType\DBField) for a full list of available Data Types. You can define your own [DBField](api:SilverStripe\ORM\FieldType\DBField) instances if required as well.
|
||||||
|
|
||||||
## Default Values
|
## Default Values
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user