Doctrine Migration, Problems Using Custom Doctrine Types

I am building an application using Symfony2 + Doctrine2. My application needs to store geospatial data, so I wrote the correct doctrine extensions. Everything works very well and the application has been running in a production environment for a long time.

Now I need to add some new features, and I need to update the database without deleting all the data. I started using DoctrineMigrationBundle, but when I ran:

$ php app/console doctrine:migrations:status 

I got this error:

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

This is the relevant section of my config.yml:

 # Doctrine Configuration doctrine: dbal: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% user: %database_user% password: %database_password% charset: UTF8 types: point: App\EngineBundle\DoctrineExtensions\PointType 

The user type 'point' has been mapped, so what am I doing wrong?

+6
source share
1 answer

I answer my question, the problem seems to be that DoctrineMigrations also needs a mapping for a custom type. Therefore, config.yml should look like this:

 # Doctrine Configuration doctrine: dbal: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% user: %database_user% password: %database_password% charset: UTF8 types: point: App\EngineBundle\DoctrineExtensions\PointType mapping_types: point: point 
+12
source

Source: https://habr.com/ru/post/920414/


All Articles