smindel / silverstripe-gis

Adds support for geographic types.
BSD 3-Clause "New" or "Revised" License
9 stars 5 forks source link

Enhancement: Allow magic getters to work in geojsonservice static #15

Closed phptek closed 5 years ago

phptek commented 5 years ago

It would be great if the $geojsonservice static accepted strings that mapped to methods, just like $summary_fields works.

Then we can do stuff like this, where the map's JS has access to layer.feature.properties.foo for each model:

    private static $geojsonservice = [
        'geometry_field' => 'Location',
        'searchable_fields' => [
            'Address',
            'Location',
        ],
        'property_map' => [
            'ID' => 'id',
            'Type' => 'type',
            'Foo' => 'foo',
        ],
    ];

    public function getFoo()
    {
        return 'Bar';
    }
smindel commented 5 years ago

Mate, this should work...