Doctrine 2 + unsigned value

前端 未结 5 1716
闹比i
闹比i 2021-01-31 13:21

Is it possible to specify a column type of unsigned integer in Doctrine 2?

5条回答
  •  鱼传尺愫
    2021-01-31 13:49

    Doctrine 1 documentation and Doctrine 2 documentation said you can do it by this ways:

    PHP annotations:

    /**
     * @Column(type="integer", name="some_field" options={"unsigned":true})
     */
    protected $someField;
    

    Yaml: (see docs)

    MyEntity:
      fields:
        someField:
          type: integer
          column: some_field
          options:
            unsigned: true
    

    Hope this helps to someone to save a time ;)

提交回复
热议问题