Skip to content
Mark edited this page Oct 12, 2023 · 12 revisions

CakePHP version map

Geo plugin branch CakePHP core PHP min
1.x [EOL] cake3 3.x PHP 5.6
2.x cake4 4.x PHP 7.2
3.x master 5.x PHP 8.1

The CakePHP 2.x version info and documentation, as well as a detailed article, can be found at http://www.dereuromark.de/2012/06/12/geocoding-with-cakephp/

Useful tips

By default, the custom finder only returns the virtual "distance" field. If you want all fields to be retrieved by default, use Query::autoFields(true) on top of your query settings:

return $this->find('all')->find('distance', $options)->where(...)->autoFields(true);

Migration guide from CakePHP 2.x

  • The behavior is now added inside Table::initialize():
      public function initialize(array $config) {
      	$this->addBehavior('Geo.Geocoder', [
      			'address' => [
      				'street', 'postal_code', 'city',
      			]
      	]);
    
      	parent::initialize($config);
      }
  • Use the custom finder Query::find('distance', $options) instead of adding virtual fields.
  • The config option before is now on.
Clone this wiki locally