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

Extending Class with self::

Discussion in 'XenForo Development Discussions' started by Marcus, Nov 2, 2013.

  1. Marcus

    Marcus Well-Known Member

    When I extend a class with self:: and reusing something of its code at the beginning to check (calling the parent function later), from my understanding I should have to change self:: with $this, is that correct?

    Or has self:: also access to the parent functions my class is extending?
  2. Chris D

    Chris D XenForo Developer Staff Member

    self:: refers to the current class.

    $this refers to the current object.
    Marcus likes this.
  3. Marcus

    Marcus Well-Known Member

    class Alerts_Model_Alert extends XFCP_Alerts_Model_Alert
    public function 
    markAllAlertsReadForUser($userId$time null)
      if (
    So this code in my addon would also check against the extended classes constant PREVENT_MARK_THREAD, is that right?

Share This Page