[prev in list] [next in list] [prev in thread] [next in thread]
List: php-internals
Subject: Re: [PHP-DEV] late static binding php6
From: Gergely Hodicska <felho () avalon ! aut ! bme ! hu>
Date: 2007-11-18 11:27:41
Message-ID: 474021AD.3020902 () avalon ! aut ! bme ! hu
[Download message RAW]
Hi!
I read this thread, and I would like to ask if is there any decision
about the behavior of inheritance?
I wrote on my blog about late static binding
(http://blog.felho.hu/what-is-new-in-php-53-part-2-late-static-binding.html),
and I came up with the following example:
<?php
class ActiveRecord
{
public static function findByPk($id)
{
$calledClass = get_called_class();
// The magic remains...
}
}
class Blog extends ActiveRecord
{
public static function findByPk($id)
{
// We want to log something.
// Then the parent should do the magic.
parent::findByPk($id);
}
}
Blog::findByPk(1);
?>
In think it would be nice if I could write codes like this. But in the
current snapshot the value of $calledClass is ActiveRecord.
Best Regards,
Felhő
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Donate |
Add a list |
Sponsors: 10East, KoreLogic, Terra-International, Chakpak.com