Skip to content

Commit

Permalink
Merge pull request #7884 from cakephp/geospatial-types
Browse files Browse the repository at this point in the history
Adding docs for cakephp/cakephp#17733
  • Loading branch information
markstory committed Jul 9, 2024
2 parents 68d52e1 + b774392 commit 900906f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions en/appendices/5-1-migration-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ Controller
Database
--------

- Support for ``point``, ``linestring``, ``polygon`` and ``geometry`` types were
added. These types are useful when working with geospatial or cartesian
co-ordinates. Sqlite support uses text columns under the hood and lacks
functions to manipulate data as geospatial values.
- ``SelectQuery::__debugInfo()`` now includes which connection role the query
is for.

Expand Down
22 changes: 22 additions & 0 deletions en/orm/database-basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,14 @@ json
Maps to a ``JSON`` type if it's available, otherwise it maps to ``TEXT``.
enum
See :ref:`enum-type`.
geometry
Maps to a generic geometry storage type.
point
Maps to a single point in geospatial storage.
linestring
Maps to a single line in geospatial storage.
polygon
Maps to a single polygon in geospatial storage.

These types are used in both the schema reflection features that CakePHP
provides, and schema generation features CakePHP uses when using test fixtures.
Expand All @@ -411,6 +419,10 @@ automatically convert input parameters from ``DateTime`` instances into a
timestamp or formatted datestrings. Likewise, 'binary' columns will accept file
handles, and generate file handles when reading data.

.. versionchanged:: 5.1.0
The ``geometry``, ``point``, ``linestring``, and ``polygon`` types were
added.

.. _datetime-type:

DateTime Type
Expand Down Expand Up @@ -491,6 +503,16 @@ CakePHP recommends a few conventions for enums:
- Enums should implement the ``Cake\Database\Type\EnumLabelInterface`` to
improve compatibility with bake, and ``FormHelper``.

Geospatial Types
----------------

The ``geometry``, ``point``, ``linestring``, and ``polygon`` types are also known
as the "geospatial types". CakePHP offers limited support for geospatial
columns. Currently they can be defined in migrations, read in schema reflection,
and have values set as text.

.. versionadded:: 5.1.0
Geospatial schema types were added.

.. _adding-custom-database-types:

Expand Down

0 comments on commit 900906f

Please sign in to comment.