Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10752 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45316 invoked by uid 1010); 24 Jun 2004 11:13:26 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 45230 invoked from network); 24 Jun 2004 11:13:26 -0000 Received: from unknown (HELO lakermmtao07.cox.net) (68.230.240.32) by pb1.pair.com with SMTP; 24 Jun 2004 11:13:26 -0000 Received: from [192.168.3.100] (really [68.98.128.109]) by lakermmtao07.cox.net (InterMail vM.6.01.03.02 201-2131-111-104-20040324) with ESMTP id <20040624111326.HUXL27959.lakermmtao07.cox.net@[192.168.3.100]>; Thu, 24 Jun 2004 07:13:26 -0400 Message-ID: <40DAB758.1020709@velum.net> Date: Thu, 24 Jun 2004 07:13:28 -0400 User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Taco Van Den Broek CC: internals@lists.php.net References: <40DA29C3.1090301@velum.net> <20040624074757.1883.qmail@pb1.pair.com> In-Reply-To: <20040624074757.1883.qmail@pb1.pair.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: static/object method From: hans@velum.net (Hans Lellelid) Taco Van Den Broek wrote: > Hans Lellelid wrote: >> static, default behavior, probably accounts for 80% of uses: >> >> $c = new Criteria(Author::NAME, "Leo"); >> $a = AuthorFinder::find($c); > > > You pass your criteria to your search class as instantiated objects, why > don't you pass your parameters/config flags as another type of object? > Maybe like this: > > $c = new Criteria(Author::NAME, "Leo"); > $f = new ConfigFlag(AuthorFinder::LIMIT, '5'); > $a = AuthorFinder::find($c, $f); > > You could then check the $f object for any customizations, just like you > check the $c object for where to search. That's a good suggestion -- probably the cleanest design possible in current PHP object model. Thanks, Hans