I have a custom model in a custom Magento model with a static function:
class ABC_Module_Model_ClassName
{
static public function send ( $something)
{
// do something static
}
}
Now I call the function like this:
ABC_Module_Model_ClassName::send($something); // works and is nothing wrong with it
More for consistency purposes, I would like to know if Mage has an internal way of calling static methods, something like this:
Mage::getModel('abc/module_className')::send($something); // this is wrong
// or
Mage::getModel('abc/module_className', send($something)); // with a callback or something
Given that any method like Mage::getModel() will actually return an instance of the class, you'll be calling it dynamically rather than statically. E.g you'd be doing $module->staticMethod(); instead of Module::staticMethod()..
So your best best is to
Common so you won't have to type the really long name, Module::method().In the end, the only way to call a method statically is via Class::method().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With