ID: 28052
Updated by: [EMAIL PROTECTED]
Reported By: daemorhedron at siliconjesters dot com
Status: Bogus
Bug Type: Class/Object related
Operating System: mdk 9.2 and win xp
PHP Version: 5.0.0RC1
New Comment:
One method would be to use class overloading via the __call method to
dispatch certain methods to other classes via a static call (the value
of $this will propagate into the target class).
class one {
function foo() {
echo "Foo";
}
function __call($fname) {
switch ($fname) {
case 'bar':
two::bar();
break;
default:
trigger_error("Unknown method one::$fname()", E_USER_ERROR);
break;
}
}
}
class two {
function bar() {
echo "bar";
}
}
Which, of course, can be massaged to make it a bit prettier/cleaner,
but that's the concept.
You might try taking a look at http://pecl.php.net/classkit but bearing
in mind that this extension is still experimental.
The function you'd be most interrested in is classkit_import()
(documentation not built yet, but you can read the doc sources at:
http://cvs.php.net/co.php/phpdoc/en/reference/classkit/functions/classkit-import.xml
)
Previous Comments:
------------------------------------------------------------------------
[2004-09-10 22:11:40] MichaelGlazer at quickenloans dot com
It is due to this that we will not be able to migrate to PHP5.
We require multiple inheritance that the aggregate function provided.
------------------------------------------------------------------------
[2004-07-20 07:37:50] progrium at gmail dot com
Yes, I'm also curious as to what the best alternative is for
aggregation. What are these other mechanisms?
------------------------------------------------------------------------
[2004-07-14 14:12:51] php at soapi dot com
In that case, what are we supposed to use? What do Zend recommend as
the best alternative to aggregate? I use aggregate extensively in my
code, and I was suprised that it is not part of PHP5. This does not
seem to have been mentioned in the documentation - rather, it seems to
imply that aggregate functions were added for forwarf-compatibility
with PHP5.
So please, enlighten us, what do you recommend we do instead?
------------------------------------------------------------------------
[2004-07-14 14:10:59] php at soapi dot com
In that case, what are we supposed to use? What do Zend recommend as
the best alternative to aggregate? I use aggregate extensively in my
code, and I was suprised that it is not part of PHP5. This does not
seem to have been mentioned in the documentation - rather, it seems to
imply that aggregate functions were added for forwarf-compatibility
with PHP5.
So please, enlighten us, what do you recommend we do instead?
------------------------------------------------------------------------
[2004-04-19 09:12:20] [EMAIL PROTECTED]
PHP 5 no longer supports object aggregation, there are plenty of other
mechanisms to use.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/28052
--
Edit this bug report at http://bugs.php.net/?id=28052&edit=1