Re: Getting and Setting and best practise




"Jim" <jimyt@xxxxxxxxx> wrote in message
news:1177180911.763041.218230@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| 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:

yes, it is natural. however you cannot currently control the immediate
validation of the property being accessed. __set and __get do NOT do what
you think it does.

| 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.

this is all common stuff that everyone wants/has to do. however, you cannot
do it immediately when a property is set, unless you use a public setter.

| 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?

all of it is very sensible. i just wish __set and __get would work on
DEFINED properties instead of UNDEFINED properties of a class.


.



Relevant Pages

  • Re: Getting and Setting and best practise
    ... opinion. ... Truth is, I like the idea of being able to set a property ... there'll be validation taking place. ... validation should allow the user to continue assigning values to other ...
    (comp.lang.php)
  • Re: Before Update Event
    ... Instead of assigning the values for the new record in Form_Current, ... If the EmpID is named in the subform control's ... So I moved the validation from the ... > the validation from the default navigation buttons. ...
    (microsoft.public.access.forms)
  • Re: From a non-Bahai: re-envisioning progressive revelation
    ... Are you searching for truth or are ... > validation your looking for well, I apologize that we aren't doing such ... If you look at my original post, ...
    (talk.religion.bahai)
  • Re: validation help requested
    ... have only recently gotten interested in validation. ... I assume that DW added that line when the page was brand new. ... Truth be told, I have not taken the time ... Prev by Date: ...
    (alt.html)
  • Re: From a non-Bahai: re-envisioning progressive revelation
    ... JanetDoe wrote: ... If you are searching for truth, then you should be willing to have your ... validation your looking for well, I apologize that we aren't doing such ...
    (talk.religion.bahai)