0

What is exactly the difference between:

$model = \JModelLegacy::getInstance('Objects', 'MyModel'); 

and

$model = BaseDatabaseModel::getInstance('Objects', 'MyModel'); 

Is there some performance differences? Is one of them getting removed earlier in Joomla 5? The communcation and documentation around the Joomla Framework is bad.

I cannot do this yet so please dont suggest:

$model = $component->getMVCFactory()->createModel($modelName, $this->app->getName(), ['ignore_request' => true]); 

1 Answer 1

1

JModelLegacy is now just an alias of BaseDatabaseModel to support older references to JModelLegacy therefore there is no difference at all between either statement.

JLoader::registerAlias('JModelLegacy', '\\Joomla\\CMS\\MVC\\Model\\BaseDatabaseModel', '6.0'); 

The createModel() function in the LegacyFactory class, not the createModel() method you have shown above from MVCFactory, also uses BaseDatabaseModel::getInstance

2
  • OK. And will one of them dissapear in Joomla 5 first or will they both be kept for supporting deprecated stuff? Commented Aug 16, 2023 at 8:31
  • JModelLegacy will be removed in 5. It has been depreciated for some time already. Commented Aug 16, 2023 at 10:24

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.