php best practice for validating setter when overloading class properties

solom

New Member
I have a class that uses the __set magic method. One of the properties for the class can only be set with a certain range of string values, the best example I can think of is the mysql datatype ENUM('value_one','value_two','value_three'). Would I place conditional statements within the __set method to distinguish between which property is being set and whether the value is valid for that property? Are large switch statements inside a __set method considered sloppy practice, is their a better way of producing the desired results?Thanks,Ben
 
Back
Top