Doctrine enum type by value

Posted by MitMaro on Stack Overflow See other posts from Stack Overflow or by MitMaro
Published on 2010-05-25T18:29:25Z Indexed on 2010/05/25 18:31 UTC
Read the original article Hit count: 291

Filed under:
|

I have a column in a table defined as following in my yaml file:

myTable:
  columns:
    value:
      type: enum
      length: 2
      values: ['yes', 'no']

In the code I am trying to insert data into this table but I can't figure out a way to insert the data using the enum text value (ie. 'yes' or 'no').

What I was trying was is something like this:

$obj = new myTable(); // the model for this table
$obj->value = 'yes'; // if I use the numerical value for this it works

I am using Doctrine 1.1.0.

© Stack Overflow or respective owner

Related posts about php

Related posts about doctrine