- General
- Articles
- Roadmap
- Release 3.0
- RedBeanPHP vs NoSQL
- Special Types
- Legacy
- Misc
- Third Party
- Who uses RedBeanPHP
- Personal
Special Types
Special types in RedBeanPHP 3.0 are date, datetime and spatial types. The exact number of special types depends on your database driver. More special types may follow. A value that is considered special causes the corresponding column in fluid mode to be created to match the special data type. For instance if you store the value POINT(1 2) in a bean property and the corresponding column does not exist, it will be created with a spatial data type. If the column already exists, the column will be converted to a type that is big enough to support the textual representation of POINT(1 2). In most cases this will be TEXT or VARCHAR depending on the previous contents of the column and the driver.
Conversions
Existing columns are never converted to support special types because if a column is NOT already a special type (i.e. DATE) you would lose the data in this column due to conversion. In Postgres you would simply get an error because Postgres is much more strict with types. Also once your column has been added as a special type column like DATE, the column will remain special, accidentily inserting an invalid date will not cause the column to get converted back to say TEXT.
Tweet
User contributed notes. Please use the comment section to provide tips, notes and examples. To ask for support or to provide feedback use the forum. For bug reports use Github Issue Tracker.
Site comments powered by Disqus