Skip to content
mscherer edited this page Apr 3, 2020 · 12 revisions

CakePHP version map

Geo plugin branch CakePHP core PHP min
1.x cake3 3.x PHP 5.6
2.x master 4.x PHP 7.2

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 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