-- Charles Hoffman <[EMAIL PROTECTED]> wrote
(on Friday, 25 April 2008, 09:03 AM -0500):
> On Thu, 2008-04-24 at 23:58 -0500, Aldemar Bernal wrote:
> > I understand what you are trying to do, unfortunely get_class(self)
> > will not work if self is an extended class (as Zend_Db tables are),
> 
> What about __CLASS__ ?

__CLASS__ returns the class name of the class in which it was written --
not the current instance.

    abstract class Foo
    {
        public static function getInfo()
        {
            return __CLASS__;
        }
    }

    class Bar extends Foo
    {
    }

    class Baz extends Foo
    {
        public static function getInfo()
        {
            return parent::getInfo();
        }
    }

    echo Bar::getInfo(); // 'Foo'
    echo Baz::getInfo(); // 'Foo'

Trust me, there's no way to do what you're wanting to do until 5.3, when
late static binding will be available.

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to