Hi!

why would anyone need that?

To use function that does use static without dependence on in which context if was called (or, explaining it other way, when your chain of inheritance serves multiple purposes):

class ActiveRecord {
        static function getRow($condition) {
                $table = new Table(get_called_class());
                return $table->find($condition);
        }
}

class Users extends ActiveRecord {
}

class DepartmentUsers extends Users {
        static function find($user) {
                if(self::user_in_department($user)) {
                        return parent::getRow("user=$user");
                }
                return false;
        }
}

$user = DepartmentUsers::find("bob");

Now in this case if your way is implemented, ActiveRecord would try to find table for DepartmentUsers, which probably does not exist. You would have to name Users by name there to do what this code wants to do, which leads us back to "why we have parent:: at all" argument.

"parent" is related to inheritance and it is logical, that it retains
call-chain.

It is "logical" if you look at it with the narrow point of view of what you need for your particular application. However, there are other use cases. Automatic forwarding may become very awkward if you have multiple levels of inheritance not all of them used for the same thing.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

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

Reply via email to