-
Notifications
You must be signed in to change notification settings - Fork 48
Type Normalization
Romans Malinovskis edited this page Aug 19, 2016
·
10 revisions
Agile Data recognizes some of the basic types. All persistence drivers are requested to properly handle those types. For instance a type 'date' will be set using a PHP's default date type. When storing into MySQL this must be converted to the native format (stirng). On other hand, if that is saved into 'MongoDB' then MongoDate must be used instead.
| type | alias(es) | description | native | sql | mongo |
|---|---|---|---|---|---|
| int | integer | will cast to int make sure it's not passed as a string. | -394, "49" | 49 | 49 |
| float | decimal number with floating point | 3.2884, | |||
| money | Will convert loosly-specified currency into float or dedicated format for storage. Optionally support 'fmt' proprety. | "£38,294.4800002" | 38294.48 | ||
| bool | boolean | true / false type value. Optionally specify 'enum'=>['Y','N'] to store true as 'Y' and false as 'N'. By default uses [1,0]. | true | 1 | true |
| array | Optionally pass 'fmt' option, which is 'json' by default. Will json_encode and json_decode(..., true) the value if database does not support array storage. | [2=>"bar"] | {2:"bar"} | stored as-is | |
| binary | Supports storage of binary data | ||||
Agile Data, Documentation and Wiki content is licensed under MIT and (c) by Agile Toolkit Limited UK