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

Using Class Constants

Discussion in 'XenForo Development Discussions' started by ajnos, Mar 8, 2011.

  1. ajnos

    ajnos Member

    We have defined some constants in our datawriter.

    Is it ok, if we access them in other classes (controlller, model) with:
    PHP:
       ...
            
    $dw->set('status'Ragtek_AS_DataWriter_Article::ARTICLE_REVIEW);
            
    $dw->save();
        }
    or could there be any problems because of the xenforo autoloader or the event listeners (if an add-on extends our datawriter)?
     
  2. Mike

    Mike XenForo Developer Staff Member

    It should be fine.

    However, if your class uses the XFCP system, you need to ensure that it's loaded that way rather than by the autoloader. Generally speaking, this will happen for you as you'll have created the class before you try to use a constant, but there are cases where that may not happen.
     

Share This Page