What is the proper way to handle constants in models with Magento? For example, I have an Export
class that have numerous status', such as
Currently, I have these defined at the top of the model like this, but I feel this is not the best solution:
define("CANCELLED","Cancelled");
define("INCOMPLETE","Incomplete");
define("PENDING","Pending");
define("COMPLETE", "Complete");
For instance, in a controller, if I want to update the status of a sales order (which has custom fields that my model references) with PENDING, at the moment, I am running the below purely so that it includes the file that has the constants defined:
Mage::getModel("efinterface/export");
Any advice appreciated.
Maybe define them as class constants
class SomeClass {
const CANCELLED = 'Canceled';
[...]
}
Then in your code echo SomeClass::CANCELLED;
would give you the text Canceled