Added support for multiple decorators
authorMatthias Schmidt <gravatronics@live.com>
Wed, 20 Jul 2011 22:25:51 +0000 (00:25 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Wed, 20 Jul 2011 22:25:51 +0000 (00:25 +0200)
It should be possible that a class that extends DatabaseObjectDecorator
is decorated again (basic principle of the decorator pattern) which isn'
t the case at the moment since the original object's methods can't be ca
lled anymore, so we need to check if the base class itself is a decorate
d object before the exception is thrown that the method doesn't exist.

wcfsetup/install/files/lib/data/DatabaseObjectDecorator.class.php

index 3ca2b7cd1d7685ef7745e0c3f1ca1c315f53f5c5..001ae7afb31ca27557b7de95ed100fce80a480ec 100644 (file)
@@ -65,7 +65,7 @@ abstract class DatabaseObjectDecorator extends DatabaseObject {
         * @return      mixed
         */
        public function __call($name, $arguments) {
-               if (!method_exists($this->object, $name)) {
+               if (!method_exists($this->object, $name) && !($this->object instanceof DatabaseObjectDecorator)) {
                        throw new SystemException("unknown method '".$name."'");
                }