Re: static/object method
| From: | Hans Lellelid | Date: | Thu, 24 Jun 2004 02:32:41 +0000 |
| Subject: | Re: static/object method | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10742@lists.php.net to get a copy of this message | ||
Andre Cerqueira wrote:
Well, kinda, yeah. The other part of the equation is that this class is generated, which is what allows it to be static. The default values for things are built into the class as static properties or class constants or whatever. The idea is that most of the time this class is really a static class, which needs no object instance to perform 'find' functions. Of course, you're right, using it non-statically only is a solution, but it would be far more elegant (IMO) if that weren't necessary :) Cheers, Hans$c = new Criteria(Author::NAME, "Leo"); $a = AuthorFinder::find($c); instantiated behavior for performing customizations: $c = new Criteria(Author::NAME, "Leo"); $af = new AuthorFinder(); $af->setLimit(5); $a = $af->find($c);I think it should be constructor's job to set up an instance with the defaults. (no need for static in this case) Am i missing something? static, default behavior, probably accounts for 80% of uses: