-- O'BRIEN, Steven X <[EMAIL PROTECTED]> wrote (on Wednesday, 12 November 2008, 10:14 AM -0000): > The use of __call on php classes feels like it should be bad practise > to me. Am I missing something? > > A few thoughts... > > #1 won't __Call be called every time any method is called on the > object? This feels inefficient.
No. It is only called when the called method does not exist in the class. > #2 It hides functionality. To remember what extra methods exist and > their parameters you have to specifically look up the __call function > or go to the source code. In ZF, we primarily use it for delegating to plugin classes -- in which case we have thorough documentation. A good example of this is Zend_View, where it is used to delegate to the various view helpers. In a few areas, __call() is used to simplify implementation -- for instance, when there are many methods with identical signatures -- but these are exceptions. -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/