I am writing a function that calls another class and returns it so that I can execute my methods as $this->myUser()->getUsername()... now my question is:
Is there a way for me to intercept the ->getUsername() from inside myUser() or intercept the fail to find?...
This is because I want to use another class that is myUserExtended() and I was wondering if I could route them both together inside myUser(). so that if ->getCity() is not in myUser() it automaticaly goes on and uses another variable that containts myUserExtended().
Probably is not possible, but it is worth asking.
private function myUser( $setMyUser = false ) {
if( $setMyUser ) {
$this->_myUser = $setMyUser;
}
if( empty( $this->$_myUser ) ) {
$this->_myUser = UserQuery::create()->findPK( $this->variables('userID') );
}
return $this->_myUser;
}