Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10743 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75012 invoked by uid 1010); 24 Jun 2004 03:39:15 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 74988 invoked by uid 1007); 24 Jun 2004 03:39:15 -0000 Message-ID: <20040624033915.74987.qmail@pb1.pair.com> To: internals@lists.php.net Date: Thu, 24 Jun 2004 00:39:04 -0300 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en MIME-Version: 1.0 References: <40DA29C3.1090301@velum.net> <20040624015846.64770.qmail@pb1.pair.com> <40DA3D49.4030800@velum.net> In-Reply-To: <40DA3D49.4030800@velum.net> X-Enigmail-Version: 0.83.6.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 201.8.2.4 Subject: Re: static/object method From: accerqueira@superig.com.br (Andre Cerqueira) Sorry, I probably underestimated the question I just thought it would make things simple I'm still learning that OO stuff hehe, thought static would set the scope to class instead of object for find. That way you would have to pass the object as a parameter to the static find, so that it would get access to object data (since find is from the class, not the object). And that didn't seem like an elegant way eighter hehe Probably there are other ways... I should have waited for other replies, shut up and read hehe, but i fail that from time to time... Hans Lellelid wrote: > Andre Cerqueira wrote: > >> > >> $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: > > > > 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