How to call static method in user class magento

I have a user model in a Magento user model with a static function:

class ABC_Module_Model_ClassName
{
    static public function send ( $something)
    {
         // do something static
    }
}

Now I call the function as follows:

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 to call 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
+3
source share
1 answer

Given that any method like this Mage::getModel()will actually return an instance of the class, you will call it dynamically, not statically. For example, you do $module->staticMethod();instead Module::staticMethod()..

So best

  • either a static method as a regular function, so it will be available around the world,
  • - Common, ,
  • , , Module::method().

, - Class::method().

+5

Source: https://habr.com/ru/post/1735205/


All Articles