clickbar / laravel-magellan

A modern PostGIS toolbox for Laravel
MIT License
193 stars 11 forks source link

feat: Remove redundant eloquent queries with no geometry changes #65

Closed adamczykpiotr closed 5 months ago

adamczykpiotr commented 7 months ago
$generator = app()->make(\Clickbar\Magellan\IO\Generator\WKB\WKBGenerator::class);
$parser = app()->make(\Clickbar\Magellan\IO\Parser\WKB\WKBParser::class);

// Parse & generate original geometry
// Geometry internally remains unchanged but object reference has changed
$model->geometry = $parser->parse(
    $generator->generate($model->geometry)
);

Before:

> $model->isDirty()
= true

After:

> $model->isDirty()
= false
saibotk commented 7 months ago

Oh jeah we noticed this too and actually resolved this whole problem by rewriting the casting to casters in the upcoming version. Which will probably gain traction this holiday season again. But ill talk with @ahawlitschek if we would include this as a fix for the 1.x release.

So thank you very much 👍