Questions tagged [model]
For questions regarding Models used in software to manage the data, logic and rules of the application.
82 questions
1 vote
1 answer
83 views
Naming of Models, Fields Controllers and Helpers (CamelCase)
What drives me crazy with Joomla! and I still don't understand: If I create a model for a component or module and this consists of several words (for example File Item) then I call the model in ...
0 votes
2 answers
222 views
How to create administrator model from site and vice versa?
This question has been asked before, more than once. However, things have changed a lot and the previous answers are all outdated. In Joomla 3.x, we used to do: BaseDatabaseModel::addIncludePath(...
0 votes
1 answer
50 views
How to specify more than one value for filter.access?
I am developing a backend plugin and I need to count the elements returned by a search, but I don't know how to specify multiple values for one field using the setState method. This is the code: $...
0 votes
1 answer
127 views
Get Joomla Articles via Model inside static (Module) Method
When calling an AJAX Method in a Module Helper file the method has to be static. I have no app context there, when doing the following: public static function getDataAjax() { $data = ...
1 vote
2 answers
99 views
Getting a model in the controller
Is there any difference in these two inside a frontend controller? Performance or memory wise? In the end both are doing createModel, right? Thanks! $model = $this->getModel('Object', 'Site'); vs $...
0 votes
1 answer
133 views
Calling getState Model method in a custom model method
I have a method in a model and I need the array of state variables. In controller it's easy, simply get an $model object and get the array with $state = $model->getState(); But in a model all my ...
0 votes
1 answer
83 views
J4 -Custom Component - Router Unknown $pk in model
I've added Router Features today to my Custom Component - all works finde beside the fact that the $pk variable inside the model holds a curios value (202n) where 'n' is different for each element... ...
0 votes
1 answer
121 views
Differences in getting a model
What is exactly the difference between: $model = \JModelLegacy::getInstance('Objects', 'MyModel'); and $model = BaseDatabaseModel::getInstance('Objects', 'MyModel'); Is there some performance ...
1 vote
1 answer
112 views
Customizing 'Item Saved' message in custom component
I'm trying to find a way to customize the message displayed after a successful record has been saved in a custom component. Well not really the entire message, just the 'item' part. For instance if my ...
1 vote
0 answers
83 views
Ignore active filter states when getting items from ListModel
When trying to get all items from my list model inside a plugin, I use this: $objects = $app->bootComponent('com_foo')->getMVCFactory()->createModel('Objects', 'MyModel', ['ignore_request' =&...
0 votes
1 answer
638 views
How can I use two models in my custom component view in Joomla4?
I need to use two models in a view for my custom component in Joomla 4. I saw this post for Joomla 3, but it seems that there isn't getInstance() in the base Models anymore. How I could do it ?
1 vote
1 answer
242 views
I want to display a form with the data added already
public function getLaymanLayout($id){ $form = $this->getForm(); $form->bind(0); } I still have a lot to implement and make it correct to the MVC rules. I want to call a table from the ...
2 votes
0 answers
98 views
What to use: Table store vs. prepareTable
What is the reason a Joomla integrated component like contacts sets modified and modified_by while saving once in the prepareTable() method of the Model and also in the storeTable() method? Is this ...
1 vote
0 answers
63 views
Retrieving state variables using Ajax in 3.10.4
I have a site which displays a directory of registered users on the frontend. I've allowed users to select topics of interests when they're registering. In the directory they then can search by names ...
2 votes
1 answer
353 views
Redirect controller function on load, what function do I need to use?
I have a question, and I am a bit confused where i need to put this. I have a controller which is mainly empty: class ControllerProfiles extends Controller { public function &getModel($...