Doctrine custom type always altering table

后端 未结 4 1831
醉话见心
醉话见心 2021-02-08 08:46

I have added a custom type like:

namespace My\\SuperBundle\\Types;

use Doctrine\\DBAL\\Types\\Type;
use Doctrine\\DBAL\\Platforms\\AbstractPlatform;

class Mo         


        
4条回答
  •  深忆病人
    2021-02-08 09:18

    There's an alternative way to do this using configurations.

    config.yml:

    doctrine:
        dbal:
            types: { money: My\SuperBundle\Types\Money }
    
        connections:
            your_connection_name:
                mapping_types: { money: money }
    

    Sources:

    • http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types
    • https://github.com/sonata-project/SonataUserBundle/issues/103#issuecomment-10083314

提交回复
热议问题