MySQL geometry Type Data in CakePHP 3

MySQL geometry Type Data in CakePHP 3

Takahiro Iwasa
(岩佐 孝浩)
Takahiro Iwasa (岩佐 孝浩)
1 min read
CakePHP GIS

CakePHP 3 can handle MySQL geometry type data.

$myHousesTable = TableRegistry::get('MyHouses');
$myHouse = $myHousesTable->newEntity();

$myHouse->latlng = $myHousesTable->query()->newExpr()->add(
    // Note that Point argument order is longitude followed by latitude.
    "ST_GeomFromText('Point(138.727777 35.360556)')"
);
Takahiro Iwasa
(岩佐 孝浩)

Takahiro Iwasa (岩佐 孝浩)

Software Developer at KAKEHASHI Inc.
Involved in the design, development, and operation of the prescription data collection platform