Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set enum data type in doctrine 2

In annotation based mapping, as per the documentation of doctrine, we can do as shown below:

/** @Column(type="string", columnDefinition="ENUM('visible', 'invisible')") */

My question is how do I represent this in yaml meta data file for doctrine?

I want to do something like this:

fields:
status:
  type: string
  columnDefinition: ....

I am using symfony 2 as framework

like image 752
sonam Avatar asked Sep 17 '12 05:09

sonam


2 Answers

Just use:

fields:
status:
  type: string
  columnDefinition: ENUM('visible', 'invisible')
like image 114
Carlos Granados Avatar answered Sep 28 '22 02:09

Carlos Granados


status:
    type: enum
    values: ['visible', 'invisible']

https://www.doctrine-project.org/projects/doctrine1/en/latest/manual/yaml-schema-files.html#enums

like image 23
Serghei Niculaev Avatar answered Sep 28 '22 02:09

Serghei Niculaev