how to overload accessible methods
| From: | Ryan Sun | Date: | Tue, 13 Apr 2010 15:39:46 +0000 |
| Subject: | how to overload accessible methods | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-304031@lists.php.net to get a copy of this message | ||
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()
{
//....
}
private function _update($args)
{
//....
}
}
$user = new User();
$user->update() // will call _validate before _update automatically
BUT, if I want to make this update a public function, how can I call
the validate without call it inside update function explicitly?