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

“Unknown database type point requested” on schema update #176

Open
jaikdean opened this issue Jun 6, 2017 · 6 comments
Open

“Unknown database type point requested” on schema update #176

jaikdean opened this issue Jun 6, 2017 · 6 comments

Comments

@jaikdean
Copy link

jaikdean commented Jun 6, 2017

I have the following setup in a Symfony 3.3 app:

# config.yml
doctrine:
    dbal:
        types:
            geography_point: CrEOF\Spatial\DBAL\Types\Geography\PointType
class Outlet
{
    /**
     * @var CrEOF\Spatial\PHP\Types\Geography\Point
     * @ORM\Column(name="location", type="geography_point", nullable=true)
     */
    private $location;
}

This works as expected, creating the following table:

CREATE TABLE `outlet` (
  `location` point DEFAULT NULL COMMENT '(DC2Type:geography_point)'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

However, when I run a php bin/console doctrine:schema:update I get the following exception:

[Doctrine\DBAL\DBALException]                                                                     
Unknown database type point requested, Doctrine\DBAL\Platforms\MySqlPlatform may not support it.

Any ideas what to try?

@mikysan
Copy link

mikysan commented Jul 12, 2017

run into same problem!

@kmusiclife
Copy link

same problem I detected.

@braianj
Copy link

braianj commented Sep 21, 2017

same here. Any news?

@alejandrososa
Copy link

alejandrososa commented Oct 10, 2017

It´s work for me

http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html

doctrine:
    dbal:
        types:
            point:  CommonBundle\Type\PointType
        default_connection: app
        connections:
            app:
                driver: pdo_mysql
                host:   '%database_host%'
                port:   '%database_port%'
                dbname: '%database_name%'
                user:   '%database_user%'
                password: '%database_password%'
                charset: UTF8
                mapping_types:
                    enum: string
                    set: string
                    point: point

@jsampedro77
Copy link

As @alejandrososa sated, I had to declare the mapping type to get rid of this problem

doctrine:
    dbal:
        mapping_types:
            point: point

@alexislefebvre
Copy link

alexislefebvre commented Jul 5, 2018

We had a smilar problem with Symfony 4.1.1 and doctrine/orm 2.6.1

We installed this bundle in order to use the CrEOF\Spatial\DBAL\Types\Geography\PointType type.

But generating Doctrine migration triggered the following error:

Unknown database type geometry requested, Doctrine\DBAL\Platforms\PostgreSQL94Platform may not support it.

We had similar errors so we had to declare other types:

doctrine:
    dbal:
        # configure these for your database server
        driver: 'pdo_pgsql'
        server_version: '9.4'

        # With Symfony 3.3, remove the `resolve:` prefix
        url: '%env(resolve:DATABASE_URL)%'
        types:
            geometry:   CrEOF\Spatial\DBAL\Types\GeometryType
            point:      CrEOF\Spatial\DBAL\Types\Geometry\PointType
            geography:  CrEOF\Spatial\DBAL\Types\GeographyType
        mapping_types:
            _text: string # see https://groups.google.com/d/msg/doctrine-user/1F6M3NHmwak/bcpJD4DXxzIJ
    orm:
        auto_generate_proxy_classes: '%kernel.debug%'
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true
        mappings:
            #

And it worked for us.

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

7 participants