Posted by Jim on 04/21/07 18:41
I've been reading the responses eagerly and can appreciate all the
opinion. Truth is, I like the idea of being able to set a property
with:
$obj->prop = "a value";
That seems natural to me and I think it's going to be the option I
take........depending on the responses to my next question:
When properties are set, there'll be validation taking place. For
example a string might be too long or in the wrong format in which
case I need to let the user know that. Ideally the failure of
validation should allow the user to continue assigning values to other
properties and then once all the values are assigned, they can check
to see if there were any validation errors.
My first thought on this would be to have a "errors( )" method which
would return a reference to an array of error messages which the user
could then loop through and output to the browser. This same function
could again be used by "component" object when assigning the "item"
object to it to confirm it's valid.
Does this seem sensible?
Thanks,
Jimmy.
[Back to original message]
|