Re: [SMARTY-DEV] objects: one more approach

From: Date: Wed, 15 Jan 2003 17:33:10 +0000
Subject: Re: [SMARTY-DEV] objects: one more approach
References: 1 2  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-548@lists.php.net to get a copy of this message
[..] > > which should happen? > > > > $foo->bar("foo", $bar); > > > > or > > > > $foo->bar(array('p1' => "foo", 'p2' => $bar), > > $this); > > i prefer the former, since it is the most flexible and existing > object-api can be used that way. it would be great if the second could > be registered as a special method also. > I too prefer the former, the main reason why is that most objects will have been written to accept arguments in this way so if I have my fully working and tested foo class I can just drop it into smarty and don't have to write a new 'smartyBar($array,$this)' method that unpicks the arguments and then calls $this->bar($p1,$p2). If I'm exposing a lot of methods then I'm not sure I've gained anything, and I've certainly lost the re-usability of my object. just my tupence worth Nick (c)

« previous php.smarty.dev (#548) next »