3063 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 546 Views |
-
[SOLVED] Check if var is correct Enum value

1 March 2011 at 5:56am
I have a DataObject with this:
public static $db = array(
'Foo' => Enum("A,B,C,D","A")
);In a method of another DataObject I want to check if a certain $var is a valid Foo. How can I do that?
-
Re: [SOLVED] Check if var is correct Enum value

1 March 2011 at 6:10am
how about...
if (in_array($var,singleton('YourDataObject')->dbObject('Foo')->EnumValues())) {
//do stuff
}
| 546 Views | ||
|
Page:
1
|
Go to Top |


