Domanda

Is it possible to call directly from a model method from another model of the same component?

Is there any default Joomla option to call in such a way.

È stato utile?

Soluzione

Yes You can

It will not break MVC architecture,

You can check like this

if(!class_exists('VirtueMartModelUser')) require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'user.php');

            $usermodel = VmModel::getModel('user');

            $currentVMuser = $usermodel->getUser();

First you should include the model file in the required model then create the object. then call like above. This example is Virtue-mart using method

Altri suggerimenti

According to the my knowledge NO. Otherwise it will break the MVC architecture.

What you can do is

  • Replicate the function you want to use.
  • Make the call from the controller to the both method.

My Advice is to you is even if you figure out a way to do it, Don't do it. It will mess up your whole architecture.

If you have any issues please ask.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top