Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No spatial index created when using in Symfony #72

Open
loalf opened this issue Sep 13, 2024 · 0 comments
Open

No spatial index created when using in Symfony #72

loalf opened this issue Sep 13, 2024 · 0 comments

Comments

@loalf
Copy link

loalf commented Sep 13, 2024

Adding the spatial flag to the index doesn't create a spatial index.

This is my entity (partial example):

<?php

declare(strict_types=1);

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Jsor\Doctrine\PostGIS\Types\GeometryType;

#[ORM\Index(columns: ['center'], flags: ['spatial'])]
class Location
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(
        type: GeometryType::GEOMETRY, 
        options: ['geometry_type' => 'POINT', 'srid' => 4326]
    )]
    private $point = null;
}

I can see the doctrine.event_subscriber is registered

php bin/console.php debug:container --tag doctrine.event_subscriber

Symfony Container Services Tagged with "doctrine.event_subscriber" Tag
======================================================================

 ------------------------------------------------------ ------------ -------------------------------------------------------------------------- 
  Service ID                                             connection   Class name                                                                
 ------------------------------------------------------ ------------ -------------------------------------------------------------------------- 
  Jsor\Doctrine\PostGIS\Event\ORMSchemaEventSubscriber   default      Jsor\Doctrine\PostGIS\Event\ORMSchemaEventSubscriber  
 ------------------------------------------------------ ------------ -------------------------------------------------------------------------- 

But the index created is of type btree instead of GIST

Indexes:
    "location_pkey" PRIMARY KEY, btree (id)
    "idx_d2ee6cd640f0eb24" btree (center)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant