[PHP-DEV] Re: static/object method

2004-06-24 Thread 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 paramet

Re: [PHP-DEV] Re: static/object method

2004-06-24 Thread Hans Lellelid
Alan Knowles wrote: the E_STRICT warnings on static calls to non static methods are probably usefull, (as $this could be defined totally randomly), so it does make some sense.. btw: does that mean: class a { function find() { } } class b extends a { function find() { } } // call the toplevel par

Re: [PHP-DEV] Re: static/object method

2004-06-24 Thread Alan Knowles
the E_STRICT warnings on static calls to non static methods are probably usefull, (as $this could be defined totally randomly), so it does make some sense.. btw: does that mean: class a { function find() { } } class b extends a { function find() { } } // call the toplevel parent method.. (skip t

[PHP-DEV] Re: static/object method

2004-06-24 Thread Taco van den Broek
Hans Lellelid wrote: Hi all, I have a pattern I'm trying to implement in PHP5 using a class that could be called statically or non-statically. Perhaps "pattern" gives this too much legitimacy :) I can't figure out how to do this & wanted to ask if a) it's possible at all and b) if there's been

[PHP-DEV] Re: static/object method

2004-06-23 Thread 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 ge

[PHP-DEV] Re: static/object method

2004-06-23 Thread Hans Lellelid
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

[PHP-DEV] Re: static/object method

2004-06-23 Thread Andre Cerqueira
Hi 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? Hans Lellelid wrote: Hi all, I have a pattern I'm trying to implement in PHP5 using a class that could be called statically or non-statically. Perhaps "p