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

Extending the child class works, but extending its parent class does not

Discussion in 'XenForo Development Discussions' started by Marcus, May 8, 2015.

  1. Marcus

    Marcus Well-Known Member

    When I extend XenForo_DataWriter_Forum and increase the title length it works great.

    However my first idea was to only extend the parent class XenForo_DataWriter_Node and increase the title length there. But that does not work, instead I get the "please restrict your title length to 50 characters" message when saving a forum with a larger title.

    It would help my understanding of XenForos Class System greatly if I figure out why it works how it works.
  2. Xon

    Xon Well-Known Member

    The dynamic proxy system, by design, doesn't let you extend the parent class. You can only extend leaf classes in the class hierarchies
    Marcus likes this.
  3. Jake B.

    Jake B. Well-Known Member

    As far as I know this is nearly impossible to do and have it work for all node types that are created by add-ons. Hopefully it's something they address with XenForo 2.0.
    Xon likes this.
  4. Liam W

    Liam W Well-Known Member

    It's the way the class proxy is designed. It takes the class, and all proxies extend other proxies until the final proxy extends the main class.

    While I'm guessing extending parents could be implemented, it wouldn't be nice and would probably lead to confusion...

Share This Page