Using Class Constants

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)?
 
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.
 
Top Bottom