Enum only exists in mysql, so it's not that easy to create an enum
field, but fortunately it's not really difficult. This one is a propel
solution, but you should be able to apply it for doctrine:
http://snippets.symfony-project.org/snippet/107

On Sat, May 16, 2009 at 02:45, joshuacoady <[email protected]> wrote:
>
> This is my schema:
>
> EntryData:
>  columns:
>    id:
>      type: integer
>      primary: true
>      autoincrement: true
>      notnull: true
>    type:
>      type: enum
>      values: [text, xml, html]
>      notnull: true
>
> What's a working example of code for how I can create an object of
> type EntryData, set its type and save it?
>
> This throws a validation exception:
>
>      $e = new EntryData();
>      $e->type = 1;
>      $e->save();
>
>
> All of the following end up inseting a 0 into the type column in the
> DB:
>
>      $e = new EntryData();
>      $e->type = 'html';
>      $e->save();
>
>      $e = new EntryData();
>      $e->type = 'xml';
>      $e->save();
>
>      $e = new EntryData();
>      $e->type = 'text';
>      $e->save();
>
> Am I missing something?
>
> I found this in the docs that shows how to define an enum:
> http://www.doctrine-project.org/documentation/manual/1_1/en/defining-models:columns:data-types:enum
>
> But I could not find any docs for how to use an enum.
>
> Thanks!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to