Re: [PHP] Re: how to overload accessible methods

2010-04-16 Thread Ryan Sun
thanks for all your reply, since all these classes have main entry in cron.php, I have moved validation there. Richard, your solution seems interesting, maybe I can use it later :) On Thu, Apr 15, 2010 at 4:46 AM, Richard Quadling rquadl...@googlemail.com wrote: On 13 April 2010 17:25, Ryan Sun

Re: [PHP] Re: how to overload accessible methods

2010-04-15 Thread Richard Quadling
On 13 April 2010 17:25, Ryan Sun ryansu...@gmail.com wrote: this is a class for corntab job, and the validation is very simple, just check if the status of user is active when cron job runs, if not, throws an exception, other developers won't want to overwrite this validation. which method of

[PHP] Re: how to overload accessible methods

2010-04-13 Thread Nathan Rixham
Ryan Sun wrote: As we all know, __call() can overload non-accessible methods, eg. Class User { public function __call($name, $args) { //validate user $this-_validate(); $this-_{$name}($args); } private function _validate() {

[PHP] Re: how to overload accessible methods

2010-04-13 Thread Ryan Sun
I'm writing an abstract parent class which only contain a validate method, other developers will extend this class and add many new public methods, every new methods will need to perform a validate first. Won't it be good if validate get called automatically before every method call so that they

Re: [PHP] Re: how to overload accessible methods

2010-04-13 Thread Ashley Sheridan
On Tue, 2010-04-13 at 12:03 -0400, Ryan Sun wrote: I'm writing an abstract parent class which only contain a validate method, other developers will extend this class and add many new public methods, every new methods will need to perform a validate first. Won't it be good if validate get

[PHP] Re: how to overload accessible methods

2010-04-13 Thread Nathan Rixham
Ryan Sun wrote: I'm writing an abstract parent class which only contain a validate method, other developers will extend this class and add many new public methods, every new methods will need to perform a validate first. Won't it be good if validate get called automatically before every

[PHP] Re: how to overload accessible methods

2010-04-13 Thread Ryan Sun
this is a class for corntab job, and the validation is very simple, just check if the status of user is active when cron job runs, if not, throws an exception, other developers won't want to overwrite this validation. which method of user class will be called is configurable via website backed