Using Class Constants


We have defined some constants in our datawriter.

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


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.