On 2010-12-01, Arvids Godjuks <arvids.godj...@gmail.com> wrote:
> You are missing the point in PHP in that case. Because  PHP is dynamic
> scripting language, public properties can be added and removed in the
> object on the fly. That's why there is isset and unset that works on
> object properties. Consider ActiveRecord, DataMappers, ORM, etc. They
> use that 100% to their advantage - I haven't yet seen a model witch
> defines all the properties in PHP code - mostly it takes table columns
> from DB and add these properties in dynamic way.
> That's why it isn't so straight forward of adding properties like you propose.

The new generation of ORMs and data mappers are actually using plain old
PHP objects -- which means you can define the properties up-front in
your code, and the mappers then inject from whatever data source they
pull from. They're *not* defining properties on the fly. (Original
iterations of ActiveRecord and ORMs *were* -- but newer ones are
typically not.)

> P.S. By the way, maybe I haven't being doing some really crazy stuff
> on PHP, but I rarely define getters and setters in my classes that do
> something except $this->val = $val and return $this->val. Well,
> honestly I haven't worked on some stuff developed by more that 6
> programmers too (Latvia is a small county - no major epic projects at
> all), but still I think my point is valid.

I think it *used* to be... but is getting less so with modern PHP
developers, based on what I'm observing in a number of communities (ZF,
Symfony, even Lithium...). 

> 2010/12/1  <presid...@basnetworks.net>:
>>>>      public property Hours read getHours write setHours;
>>>
>>> I actually like that, though I think we should support the whole
>>> existing semantics, i.e. get/set/isset/unset. And probably keep the
>>> names, so we don't call the same thing both "read" and "get".
>>
>> This doesn't make sense.  To call isset() on a property, would be to ask
>> if the property itself exists.  But once defined, a property always exists
>> (think of methods, for example).
>>
>> (Sorry for sending again Stas, I forgot to reply all)
>> - Dennis
>>
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>


-- 
Matthew Weier O'Phinney
Project Lead            | matt...@zend.com
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to