In a CakePHP (v3) application, how can I retrieve the closest results based on passed lat lng values?
I\'d like to have them back as native CakePHP entities, so some
You need to use ConnectionManager here.
For example:
use Cake\Datasource\ConnectionManager; // Mention this first, preferably on top of the page.
$connection = ConnectionManager::get('default');
$results = $connection
->execute('SELECT * FROM articles WHERE id = :id', ['id' => 1])
->fetchAll('assoc');
You could try and set up your query in this fashion. It will definitely work.
Use this as a reference:
SELECT Statements with CakePHP 3