JModel

From Joomla! Documentation
(Difference between revisions)
Jump to: navigation, search
(New page: '''JModel''' is an abstract class which provides the basic functionality for concrete model objects in conjunction with Joomla's MVC pattern. Models that extend the JModel class are often ...)
 
m (bad link repair)
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''JModel''' is an abstract class which provides the basic functionality for concrete model objects in conjunction with Joomla's MVC pattern. Models that extend the JModel class are often defined in Joomla components and define the business logic of the specific component. See [[Developing_a_Model-View-Controller_Component_-_Part_1 | MVC Development in Joomla]]
+
This class is available in the following Joomla versions:-
 
+
<splist showpath=notparent />
===Availability===
+
<noinclude>[[Category:Platform JClasses]][[Category:JModel]]</noinclude>
{{JVer|1.5|From Joomla 1.5}} {{JVer|1.6|Joomla 1.6}}
+
 
+
===Defined in===
+
/libraries/joomla/document/document.php
+
 
+
===Extends===
+
* [[JObject]]
+
 
+
 
+
===Methods===
+
{| class="wikitable"
+
|-
+
!Method name
+
!Description
+
|-
+
|[[JModel/__construct|__construct]]
+
|Constructor
+
|-
+
|[[JModel/addIncludePath|addIncludePath]]
+
|Add a directory to the stack of paths where JModel should search for models. You may either pass a string or an array of directories. Used in [[JModel/getInstance|getInstance]] method.
+
|-
+
|[[JModel/addTablePath|addTablePath]]
+
|Adds a path to the stack of model table aths in LIFO order. These paths are used to search for Table classes in the [[JModel/getTable|getTable]] method.
+
|-
+
|[[JModel/getDBO|getDBO]]
+
|Method to get the database connector object
+
|-
+
|[[JModel/getInstance|getInstance]]
+
|Returns a reference to a Model Object, always creating it
+
|-
+
|[[JModel/getName|getName]]
+
|Method to get the model name. The model name by default parsed using the classname, or it can be set by passing a $config['name'] in the class constructor.
+
|-
+
|[[JModel/getState|getState]]
+
|Method to get model state variables
+
|-
+
|[[JModel/getTable|getTable]]
+
|Method to get a table object, load it if necessary.
+
|-
+
|[[JModel/setDBO|setDBO]]
+
|Method to set the database connector object
+
|-
+
|[[JModel/setState|setState]]
+
|Method to set model state variables
+
|}
+
===Importing===
+
<source lang="php">jimport( 'joomla.document.document' );</source>
+
 
+
===The Joomla MVC Design Pattern===
+
Model-View-Controller (MVC) is a set of design patterns, that are used to separate the different layers of your application.
+
 
+
* The '''View''' displays the data of the model by passing it to a template. The view object can therefore access the data of the model. Joomla implements the basic functionality in the abstract [[JView]] class.
+
* The '''Model''' stores the data of the application, and contains the business logic.
+
Joomla implements the basic functionality in the abstract [[JModel]] class.
+
* The '''Controller''' handles the user requests and evokes the model and the views to change it's state. Joomla implements the basic functionality in the [[JController]] class.
+
 
+
[[Developing_a_Model-View-Controller_Component_-_Part_1|Learn more about the Joomla Design Pattern]]
+
 
+
 
+
===See also===
+
* [http://api.joomla.org/Joomla-Framework/Application/JModel.html JModel on api.joomla.org]
+
<noinclude>[[Category:Development]][[Category:Framework]][[Category:JModel]]</noinclude>
+

Latest revision as of 13:57, 29 August 2012

This class is available in the following Joomla versions:-

Personal tools
Namespaces

Variants
Actions
Navigation
Joomla! Sites
Toolbox