sonam
sonam

Reputation: 3760

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

Upvotes: 7

Views: 10399

Answers (2)

Serghei Niculaev
Serghei Niculaev

Reputation: 513

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

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

Upvotes: 1

Carlos Granados
Carlos Granados

Reputation: 11351

Just use:

fields:
status:
  type: string
  columnDefinition: ENUM('visible', 'invisible')

Upvotes: 13

Related Questions