You are here: Re: Getting and Setting and best practise « PHP Programming Language « IT news, forums, messages
Re: Getting and Setting and best practise

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация