1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

What happens if the parent method is called more than once?

Discussion in 'XenForo Development Discussions' started by RastaLulz, Jan 2, 2016.

  1. RastaLulz

    RastaLulz Well-Known Member

    So I just created my first add-on, and while using load_class_* listeners, you have to call the parent method like so:

    class RastaLulz_LoggedInCookie_Model_User extends XFCP_RastaLulz_LoggedInCookie_Model_User
        public function 
    setUserRememberCookie($userId$auth null)
    $response parent::setUserRememberCookie($userId$auth);

    XenForo_Helper_Cookie::setCookie('logged_in'130 86400true);

    My question is, what happens if two add-on's are listening for a specific method, and call the parent method? Does it get executed twice?
  2. Jake B.

    Jake B. Well-Known Member

    The xenforo class proxy prevents it from executing twice. AFAIK it makes all the classes extend each other before they extend the 'real' class. Though, I may be wrong. The parent definitely won't execute twice though :)
    RastaLulz likes this.

Share This Page