6

Symfony2 + Doctrine2 を使用してアプリケーションを構築しています。私のアプリケーションは地理空間データを保存する必要があるため、適切なドクトリン拡張を作成しました。すべてがうまく機能しており、アプリは本番環境で長い間実行されています。

ここで、いくつかの新機能を追加する必要があり、すべてのデータを削除せずにデータベースを更新する必要があります。DoctrineMigrationBundle を使用することを考えましたが、実行すると:

$ php app/console doctrine:migrations:status

このエラーが発生しました:

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

これは私の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 

カスタム タイプ 'point' がマップされているのに、何が間違っているのでしょうか?

4

1 に答える 1

14

私は自分の質問に答えます。問題は DoctrineMigrations にもカスタム型のマッピングが必要なようです。したがって、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 
        mapping_types:
          point: point
于 2012-07-13T14:18:52.787 に答える