CakePHP 3 における MySQL のジオメトリ型データ

CakePHP 3 における MySQL のジオメトリ型データ

Takahiro Iwasa
Takahiro Iwasa
1 min read
CakePHP GIS

CakePHP 3 は MySQL のジオメトリ型データを処理できます。

$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 requirements definition, design, and development of cloud-native applications using AWS. Now, building a new prescription data collection platform at KAKEHASHI Inc. Japan AWS Top Engineers 2020-2023.